file
stringlengths
18
26
data
stringlengths
3
1.04M
the_stack_data/15764026.c
unsigned Cur_Vertical_Sep; unsigned High_Confidence; unsigned Two_of_Three_Reports_Valid; unsigned Own_Tracked_Alt; unsigned Own_Tracked_Alt_Rate; unsigned Other_Tracked_Alt; unsigned Alt_Layer_Value; unsigned Positive_RA_Alt_Thresh__0 ; unsigned Positive_RA_Alt_Thresh__1 ; unsigned Positive_RA_Alt_Thresh__2 ; unsigned Positive_RA_Alt_Thresh__3 ; unsigned Up_Separation; unsigned Down_Separation; unsigned Other_RAC; unsigned Other_Capability; unsigned Climb_Inhibit; void main( ) { unsigned enabled, tcas_equipped, intent_not_known; unsigned need_upward_RA, need_downward_RA; unsigned alt_sep; unsigned alim; // New variables added .... unsigned temp1,temp2,temp3,temp4; unsigned result_Non_Crossing_Biased_Climb; unsigned result_Non_Crossing_Biased_Descend; // -- initialize(); Positive_RA_Alt_Thresh__0 = 400; Positive_RA_Alt_Thresh__1 = 500; Positive_RA_Alt_Thresh__2 = 640; Positive_RA_Alt_Thresh__3 = 740; // -- alt_sep_test(); enabled=0; tcas_equipped=0; intent_not_known=0; need_upward_RA=0; need_downward_RA=0; // -- -- alim = ALIM(); if ( Alt_Layer_Value == 0 ) alim = Positive_RA_Alt_Thresh__0 ; if ( Alt_Layer_Value == 1 ) alim = Positive_RA_Alt_Thresh__1 ; if ( Alt_Layer_Value == 2 ) alim = Positive_RA_Alt_Thresh__2 ; alim = Positive_RA_Alt_Thresh__3 ; if ( (High_Confidence !=0/*JORGE*/) && (Own_Tracked_Alt_Rate <= 600) && (Cur_Vertical_Sep > 600) ) enabled = 1 ; if ( Other_Capability == 0 ) tcas_equipped = 1 ; if ( (Two_of_Three_Reports_Valid !=0 /*JORGE*/) && Other_RAC == 0 ) intent_not_known = 1 ; alt_sep = 0; if ((enabled !=0 /*JORGE*/)&& (((tcas_equipped !=0 /*JORGE*/)&& (intent_not_known !=0 /*JORGE*/)) || ! (tcas_equipped !=0 /*JORGE*/))) { ////////////////////////////////////////////////////////////////////////////// { // ENTERING Non_Crossing_Biased_Climb(); unsigned upward_preferred_1; unsigned alim_Non_Crossing_Biased_Climb; unsigned temp11,temp12,temp13; upward_preferred_1 = 0 ; result_Non_Crossing_Biased_Climb=0; // alim = ALIM() ; if ( Alt_Layer_Value == 0 ) alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__0 ; if ( Alt_Layer_Value == 1 ) alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__1 ; if ( Alt_Layer_Value == 2 ) alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__2 ; alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__3 ; // temp11 = Inhibit_Biased_Climb(); if (Climb_Inhibit==1) temp11= Up_Separation + 100; else temp11 = Up_Separation; if (temp11 > Down_Separation ) upward_preferred_1 = 1 ; if (upward_preferred_1==1) { // temp12 = Own_Below_Threat(); if (Own_Tracked_Alt < Other_Tracked_Alt) temp12 = 1 ; else temp12 = 0 ; if ( !(temp12 !=0 /*JORGE*/) || ((temp12 !=0 /*JORGE*/)&& (!(Down_Separation >= alim_Non_Crossing_Biased_Climb))) ) result_Non_Crossing_Biased_Climb = 1 ; } else { // temp13= Own_Above_Threat(); if (Other_Tracked_Alt < Own_Tracked_Alt) temp13 = 1 ; else temp13 = 0 ; if ( (temp13 !=0 /*JORGE*/) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= alim_Non_Crossing_Biased_Climb) ) result_Non_Crossing_Biased_Climb = 1 ; } } // LEAVING_NON_CROSSING_BIASED_CLIMB: ////////////////////////////////////////////////////////////////////////////// temp1 = result_Non_Crossing_Biased_Climb; // temp2 = Own_Below_Threat(); if (Own_Tracked_Alt < Other_Tracked_Alt) temp2= 1 ; else temp2 = 0 ; if ( (temp1 !=0 /*JORGE*/) && (temp2 !=0 /*JORGE*/) ) need_upward_RA = 1 ; ////////////////////////////////////////////////////////////////////////////// // temp3 = Non_Crossing_Biased_Descend(); ////////////////////////////////////////////////////////////////////////////// { // ENTERING Non_Crossing_Biased_Descend() unsigned upward_preferred_2; unsigned alim_Non_Crossing_Biased_Descend; unsigned temp21,temp22,temp23; upward_preferred_2 = 0 ; result_Non_Crossing_Biased_Descend = 0 ; // alim_Non_Crossing_Biased_Descend=ALIM() ; if ( Alt_Layer_Value == 0 ) alim_Non_Crossing_Biased_Descend= Positive_RA_Alt_Thresh__0 ; if ( Alt_Layer_Value == 1 ) alim_Non_Crossing_Biased_Descend= Positive_RA_Alt_Thresh__1 ; if ( Alt_Layer_Value == 2 ) alim_Non_Crossing_Biased_Descend= Positive_RA_Alt_Thresh__2 ; alim_Non_Crossing_Biased_Descend= Positive_RA_Alt_Thresh__3 ; // temp21 = Inhibit_Biased_Climb(); if (Climb_Inhibit==1) temp21 = Up_Separation + 100; else temp21 = Up_Separation; if ( temp21 > Down_Separation ) upward_preferred_2 = 1 ; if (upward_preferred_2==1) { // temp22 = Own_Below_Threat(); if (Own_Tracked_Alt < Other_Tracked_Alt) temp22 = 1 ; else temp22 = 0; if((temp22 !=0 /*JORGE*/) && (Cur_Vertical_Sep >= 300) && (Down_Separation >= alim_Non_Crossing_Biased_Descend) ) result_Non_Crossing_Biased_Descend = 1 ; } else { // temp23 = Own_Above_Threat(); if (Other_Tracked_Alt < Own_Tracked_Alt) temp23 = 1 ; else temp23 = 0 ; if ( !(temp23 !=0 /*JORGE*/) || ((temp23 !=0 /*JORGE*/) && (Up_Separation >= alim_Non_Crossing_Biased_Descend))) result_Non_Crossing_Biased_Descend = 1 ; } } // ENTERING Non_Crossing_Biased_Descend() ////////////////////////////////////////////////////////////////////////////// temp3= result_Non_Crossing_Biased_Descend; // temp4 = Own_Above_Threat(); if (Other_Tracked_Alt < Own_Tracked_Alt) temp4 = 1 ; else temp4 = 0 ; if ( (temp3 !=0 /*JORGE*/) && (temp4 !=0 /*JORGE*/) ) need_downward_RA = 1 ; if ((need_upward_RA !=0 /*JORGE*/) && (need_downward_RA !=0 /*JORGE*/)) alt_sep = 0; else if ((need_upward_RA !=0 /*JORGE*/)) alt_sep = 1; else if ((need_downward_RA !=0 /*JORGE*/)) { /*property3a(alim) ;*/ // TRACER/ARMC //if(Up_Separation >= alim && Down_Separation >= alim && Own_Tracked_Alt > Other_Tracked_Alt) //ERROR: goto ERROR; // TRACER _ABORT(Up_Separation >= alim && Down_Separation >= alim && Own_Tracked_Alt > Other_Tracked_Alt); alt_sep = 2; } else alt_sep = 0; } return; }
the_stack_data/156393602.c
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int a, b; scanf("%d\n%d", &a, &b); const char *numbers[9] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; for(int i = a; i <= b; ++i){ if(i > 0 && i < 10){ printf("%s\n", numbers[i - 1]); } else{ printf("%s\n", (i%2) ? "odd" : "even"); } } return 0; }
the_stack_data/94408.c
/**************************************************************** * mazeMakerSVG_v2.c * * Applies the Aldus-Broder algorithm for discovering * * uniform spanning trees within a rectangular matrix. * * See discussion in the following web pages: * * http://weblog.jamisbuck.org/2011/1/17/... * * ...maze-generation-aldous-broder-algorithm * * http://people.cs.ksu.edu/~ashley78/wiki.ashleycoleman.me/... * * ...index.php/Aldous-Broder_Algorithm.html * * * * David Sparks October 2019 * * GCC: compile with the -lm flag * ****************************************************************/ #include <stdio.h> #include <math.h> // matrix dimensions #define ROWS 32 #define COLS 24 // SVG dimensions // width in inches #define MAZEWIDTH 7.5 // line thickness in pixels #define LINEWIDTH 3 // line color in hex #define LINECOLOR #000000 // cell properties xor'd into to cell value as appropriate #define LEFTLINE 1 // print left vertical line #define TOPLINE 2 // print top horizontal line #define RIGHTLINE 4 // print right vertical line #define BOTTOMLINE 8 // print bottom horizontal line #define VISITED 16 // indicates cell has been visited #define PORTAL_LEFT 32 #define PORTAL_RIGHT 64 #define PORTAL_TOP 128 #define PORTAL_BOTTOM 256 // variables and data structures FILE * randSource; // program uses /dev/urandom // maze-related variables unsigned int mazeCell[COLS][ROWS]; unsigned int origin[] = {0, 0}; unsigned int destination[] = {0, 0}; int motion[] = {0, 0}; unsigned int unVisited = ROWS * COLS; int row; int col; unsigned int randRow; unsigned int randCol; // SVG-related variables double cornerLeft; double cornerTop; double cornerRight; double cornerBottom; // random-number generator (obtain bits from system) unsigned int rand01() { // for this to work, the randSource // file pointer must be initialized already, // that is, the file must be opened in main() unsigned int randByte = 0x80; while (randByte == 0x80) {randByte = fgetc(randSource);} if (randByte > 0x80) { randByte = 1; } else { randByte = 0; } return randByte; } int main() { // initialize variables double lineLength; double portalTag; double mazeHeight; // computed SVG dimensions lineLength = (double) MAZEWIDTH / (double) COLS; portalTag = lineLength / 5; mazeHeight = lineLength * (double) ROWS; // open random bytes file as binary read-only randSource = fopen("/dev/urandom", "rb"); // initialize mazeCell array // first give all cells a // left line and an upper line for (col = 0; col < COLS; col++) { for (row = 0; row < ROWS; row++) { mazeCell[col][row] = LEFTLINE + TOPLINE; } } // give bottom row of cells a bottom line for (col = 0; col < COLS; col++) { mazeCell[col][ROWS-1] += BOTTOMLINE; } // give right-most column of cells a right side line for (row = 0; row < ROWS; row++) { mazeCell[COLS-1][row] += RIGHTLINE; } // establish top portal on a random column randCol = fgetc(randSource) % COLS; mazeCell[randCol][0] ^= TOPLINE; mazeCell[randCol][0] ^= PORTAL_TOP; // establish a bottom portal on a random column randCol = fgetc(randSource) % COLS; mazeCell[randCol][ROWS-1] ^= BOTTOMLINE; mazeCell[randCol][ROWS-1] ^= PORTAL_BOTTOM; /* // establish left portal on a random row randRow = fgetc(randSource) % ROWS; mazeCell[0][randRow] ^= LEFTLINE; mazeCell[0][randRow] ^= PORTAL_LEFT; */ /* // establish right portal on a random row randRow = fgetc(randSource) % ROWS; mazeCell[COLS-1][randRow] ^= RIGHTLINE; mazeCell[COLS-1][randRow] ^= PORTAL_RIGHT; */ // select random starting cell origin[0] = trunc(((double) fgetc(randSource)) / 256 * COLS); origin[1] = trunc(((double) fgetc(randSource)) / 256 * ROWS); // mark it as visited mazeCell[origin[0]][origin[1]] ^= VISITED; // decrement count of unvisited cells unVisited -= 1; // visit all the other cells while (unVisited > 0) { // find a valid destination do { if (rand01() == 0) { motion[0] = (rand01() * 2) - 1; motion[1] = 0; } else { motion[0] = 0; motion[1] = (rand01() * 2) - 1; } destination[0] = origin[0] + motion[0]; destination[1] = origin[1] + motion[1]; } while ( destination[0] < 0 || destination[0] >= COLS || destination[1] < 0 || destination[1] >= ROWS ); // test destination for visited if ((mazeCell[destination[0]][destination[1]] & VISITED) == 0) { // it has not been visited // so mark it as visited mazeCell[destination[0]][destination[1]] ^= VISITED; // decrement unVisited counter unVisited -= 1; // clear appropriate boundary if (motion[0] == -1) { mazeCell[origin[0]][origin[1]] ^= LEFTLINE; } if (motion[0] == 1) { mazeCell[destination[0]][destination[1]] ^= LEFTLINE; } if (motion[1] == -1) { mazeCell[origin[0]][origin[1]] ^= TOPLINE; } if (motion[1] == 1) { mazeCell[destination[0]][destination[1]] ^= TOPLINE; } } // let destination be the new origin origin[0] = destination[0]; origin[1] = destination[1]; } // all cells visited, no more random numbers needed fclose(randSource); // print the SVG file for the maze // first, the html headers printf("<!DOCTYPE html>\n"); printf("<html>\n<head>\n"); printf("<style>\n"); // maze line style printf("\t.mLine {\n"); printf("\t\tstroke: #000000;\n"); printf("\t\tstroke-width: %dpx;\n", LINEWIDTH); printf("\t\tstroke-linecap: round;\n"); printf("\t}\n"); // portal entry dot style printf("\t.eDot {\n"); printf("\t\tfill: #000000;\n"); printf("\t}\n"); printf("</style>\n"); printf("</head>\n"); printf("<body>\n"); printf("\t<svg width=\"%fin\" height=\"%fin\">\n", MAZEWIDTH, mazeHeight); // go col by col for (col = 0; col < COLS; col++) { for (row = 0; row < ROWS; row++){ // locate the corners of the cell cornerLeft = lineLength * col; cornerTop = lineLength * row; cornerRight = cornerLeft + lineLength; cornerBottom = cornerTop + lineLength; // print the SVG group tag for the cell printf("\t\t<g id=\"row%dcol%d\">\n",row,col); // top line if (mazeCell[col][row] & TOPLINE) { printf("\t\t\t<!-- Top Line -->\n"); printf("\t\t\t<line class=\"mLine\" "); printf("x1=\"%fin\" y1=\"%fin\" ", cornerLeft, cornerTop); printf("x2=\"%fin\" y2=\"%fin\" />\n", cornerRight, cornerTop); } // left side line if (mazeCell[col][row] & LEFTLINE) { printf("\t\t\t<!-- Left Line -->\n"); printf("\t\t\t<line class=\"mLine\" "); printf("x1=\"%fin\" y1=\"%fin\" ", cornerLeft, cornerTop); printf("x2=\"%fin\" y2=\"%fin\" />\n", cornerLeft, cornerBottom); } // right side line if (mazeCell[col][row] & RIGHTLINE) { printf("\t\t\t<!-- Right Line -->\n"); printf("\t\t\t<line class=\"mLine\" "); printf("x1=\"%fin\" y1=\"%fin\" ", cornerRight, cornerTop); printf("x2=\"%fin\" y2=\"%fin\" />\n", cornerRight, cornerBottom); } // bottom line if (mazeCell[col][row] & BOTTOMLINE) { printf("\t\t\t<!-- Bottom LIne -->\n"); printf("\t\t\t<line class=\"mLine\" "); printf("x1=\"%fin\" y1=\"%fin\" ", cornerLeft, cornerBottom); printf("x2=\"%fin\" y2=\"%fin\" />\n", cornerRight, cornerBottom); } // top portal if (mazeCell[col][row] & PORTAL_TOP) { printf("\t\t\t<!-- upper portal left dot -->\n"); printf("\t\t\t<circle class=\"eDot\" "); printf("cx=\"%fin\" cy=\"%fin\" ", cornerLeft, cornerTop); printf("r=\"%fin\" />\n", portalTag); printf("\t\t\t<!-- upper portal right dot -->\n"); printf("\t\t\t<circle class=\"eDot\" "); printf("cx=\"%fin\" cy=\"%fin\" ", cornerRight, cornerTop); printf("r=\"%fin\" />\n", portalTag); } // bottom portal if (mazeCell[col][row] & PORTAL_BOTTOM) { printf("\t\t\t<!-- lower portal left dot -->\n"); printf("\t\t\t<circle class=\"eDot\" "); printf("cx=\"%fin\" cy=\"%fin\" ", cornerLeft, cornerBottom); printf("r=\"%fin\" />\n", portalTag); printf("\t\t\t<!-- upper portal right dot -->\n"); printf("\t\t\t<circle class=\"eDot\" "); printf("cx=\"%fin\" cy=\"%fin\" ", cornerRight, cornerBottom); printf("r=\"%fin\" />\n", portalTag); } // left side portal if (mazeCell[col][row] & PORTAL_LEFT) { printf("\t\t\t<!-- left portal upper dot -->\n"); printf("\t\t\t<circle class=\"eDot\" "); printf("cx=\"%fin\" cy=\"%fin\" ", cornerLeft, cornerTop); printf("r=\"%fin\" />\n", portalTag); printf("\t\t\t<!-- left portal lower dot -->\n"); printf("\t\t\t<circle class=\"eDot\" "); printf("cx=\"%fin\" cy=\"%fin\" ", cornerLeft, cornerBottom); printf("r=\"%fin\" />\n", portalTag); } // right side portal if (mazeCell[col][row] & PORTAL_RIGHT) { printf("\t\t\t<!-- right portal upper dot -->\n"); printf("\t\t\t<circle class=\"eDot\" "); printf("cx=\"%fin\" cy=\"%fin\" ", cornerRight, cornerTop); printf("r=\"%fin\" />\n", portalTag); printf("\t\t\t<!-- left portal lower dot -->\n"); printf("\t\t\t<circle class=\"eDot\" "); printf("cx=\"%fin\" cy=\"%fin\" ", cornerRight, cornerBottom); printf("r=\"%fin\" />\n", portalTag); } // close the SVG group tag for the cell printf("\t\t</g>\n"); } // end for row } // end for col // print the closing SVG tag printf("\t</svg>\n"); // close the body and html tags printf("</body>\n</html>\n"); return 0; }
the_stack_data/52580.c
#include <sys/wait.h> #include <stdlib.h> #include <sys/types.h> #include <stdio.h> #include <unistd.h> int main(int argc, char** argv) { char estado = 'p'; int my_pid = getpid(); int child_pid; printf("%d: processos antes da criação do processo filho\n", my_pid); system("ps -f"); printf("%d: criando processo filho\n", my_pid); if ((child_pid = fork()) == 0) { printf("%d: minha cópia de pid ainda tem o id de meu pai: %d\n", getpid(), my_pid); my_pid = getpid(); printf("%d: o valor da variável estado no processo filho é: %c\n", my_pid, estado); printf("%d: filho está aguardando uma entrada do teclado\n", my_pid); estado = getchar(); } else { printf("%d: processos depois da criação do processo filho\n", my_pid); system("ps -f"); printf("%d: pai está esperando pelo filho: %d\n", my_pid, child_pid); wait(&child_pid); } printf("%d: terminando com o valor da variável estado igual a: %c\n", my_pid, estado); }
the_stack_data/179831383.c
#include <stdio.h> #include <math.h> int ft_sqrt(int nb) { int i; i = 1; while ( i <= 46339 && i * i <= nb) i++; i--; if (i * i == nb) return i; else return 0; } int main(void) { int index; index = 46339 * 46339; printf("%d\n", ft_sqrt(index)); return 0; }
the_stack_data/68888284.c
//你
the_stack_data/150140960.c
#include <stdio.h> #include <string.h> #include <limits.h> /* ########################## MAZE FORMAT ########################## First triplet of numbers are the dimensions of maze (maze[o][n][m]) Attention here, the o is the floor level! Second triplet of numbers are the coordinates of the starting point Next is the maze, where F is the finish point If you want you can print the maze route with X by eliminating the comments in the code. ########################## MAZE FORMAT ########################## */ unsigned n,m,o; int shortest_counter = INT_MAX; int counter; int sw; typedef struct iji { int i; int j; int k; } iji; void print_maze_c(int maze[o][n][m]) { for (int k=0; k<o; k++) { for (int i=0; i<n; i++) { for (int j=0; j<m; j++) printf("%c ", maze[k][i][j]); printf("\n"); } printf("\n"); } printf("\n"); } void copy_maze(int shortest_sol[o][n][m], int maze[o][n][m]) { for (int level=0; level<o; level++) for (int line=0; line<n; line++) for (int coll = 0; coll < m; coll ++) shortest_sol[level][line][coll] = maze[level][line][coll]; } int can_step_here(int k, int i, int j, int maze[o][n][m]) { if (i >= 0 && j >= 0 && i <= (n-1) && j <= (m-1) && k >= 0 && k <= (o-1) ) if ((char)maze[k][i][j] == '.' || (char)maze[k][i][j] == 'F') return 1; return 0; } void baccu_traccu (int map[o][n][m], int i, int j, int k, int maze[o][n][m], int shortest_sol[o][n][m], iji route[], iji shortest_route[n*m]) { if( (char)maze[k][i][j] == 'F' ) { sw=1; //print_maze_c(maze); route[counter].i=i; route[counter].j=j; route[counter].k=k; counter++; for (int i=0; i<counter-1; i++) printf("(%d, %d, %d) ", route[i].i, route[i].j, route[i].k); printf("\n\n"); if (shortest_counter > counter) { shortest_counter = counter; copy_maze(shortest_sol, maze); for (int i=0; i<shortest_counter; i++) { shortest_route[i].i=route[i].i; shortest_route[i].j=route[i].j; shortest_route[i].k=route[i].k; } } counter --; return; } if (can_step_here(k, i, j, maze)) { route[counter].i=i; route[counter].j=j; route[counter].k=k; counter++; if (maze[k][i][j]!='F') maze[k][i][j]='x'; if (i < n-1) baccu_traccu(map, i+1, j, k, maze, shortest_sol, route, shortest_route); if (j < m-1) baccu_traccu(map, i, j+1, k, maze, shortest_sol, route, shortest_route); if (i > 0) baccu_traccu(map, i-1, j, k, maze, shortest_sol, route, shortest_route); if (j > 0) baccu_traccu(map, i, j-1, k, maze, shortest_sol, route, shortest_route); if (k > 0) baccu_traccu(map, i, j, k-1, maze, shortest_sol, route, shortest_route); if (k < o-1) baccu_traccu(map, i, j, k+1, maze, shortest_sol, route, shortest_route); if (maze[k][i][j] != 'F') { counter--; maze[k][i][j] = '.'; route[counter].i=0; route[counter].j=0; route[counter].k=0; } } } int main () { FILE *fp = fopen ("maze3d.txt", "r"); fscanf(fp," %u %u %u \n", &n, &m, &o); int maze[o][n][m]; int map[o][n][m]; int shortest_sol[o][n][m]; int start_i; int start_j; int start_k; iji route[o*n*m]; iji shortest_route[o*n*m]; memset(route, 0, o*n*m*sizeof(iji)); memset(shortest_route, 0, o*n*m*sizeof(iji)); fscanf(fp, " %d %d %d \n", &start_i, &start_j, &start_k); for (int k=0; k<o; k++) for (int i=0; i<n; i++) for (int j=0; j<m; j++) fscanf(fp," %c \n", &map[k][i][j]); copy_maze(maze,map); baccu_traccu(map, start_i, start_j, start_k, maze, shortest_sol, route, shortest_route); if (sw) { printf("Shortest solution\n"); //print_maze_c(shortest_sol); for (int i=0; i < shortest_counter - 1; i++) printf("(%d, %d, %d) ", shortest_route[i].i, shortest_route[i].j, shortest_route[i].k); } else printf("Sol doesn't exist"); return 0; }
the_stack_data/53608.c
// https://syzkaller.appspot.com/bug?id=28cccdd18b4bb8670d077937fb8d4849dca96230 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include <arpa/inet.h> #include <dirent.h> #include <endian.h> #include <errno.h> #include <fcntl.h> #include <net/if.h> #include <net/if_arp.h> #include <netinet/in.h> #include <pthread.h> #include <sched.h> #include <setjmp.h> #include <signal.h> #include <stdarg.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/epoll.h> #include <sys/ioctl.h> #include <sys/mount.h> #include <sys/prctl.h> #include <sys/resource.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/time.h> #include <sys/types.h> #include <sys/uio.h> #include <sys/wait.h> #include <time.h> #include <unistd.h> #include <linux/capability.h> #include <linux/futex.h> #include <linux/genetlink.h> #include <linux/if_addr.h> #include <linux/if_ether.h> #include <linux/if_link.h> #include <linux/if_tun.h> #include <linux/in6.h> #include <linux/ip.h> #include <linux/neighbour.h> #include <linux/net.h> #include <linux/netlink.h> #include <linux/nl80211.h> #include <linux/rfkill.h> #include <linux/rtnetlink.h> #include <linux/tcp.h> #include <linux/usb/ch9.h> #include <linux/veth.h> static unsigned long long procid; static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; int valid = addr < prog_start || addr > prog_end; if (skip && valid) { _longjmp(segv_env, 1); } exit(sig); } static void install_segv_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = segv_handler; sa.sa_flags = SA_NODEFER | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } #define NONFAILING(...) \ ({ \ int ok = 1; \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } else \ ok = 0; \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ ok; \ }) static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } static void thread_start(void* (*fn)(void*), void* arg) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); int i = 0; for (; i < 100; i++) { if (pthread_create(&th, &attr, fn, arg) == 0) { pthread_attr_destroy(&attr); return; } if (errno == EAGAIN) { usleep(50); continue; } break; } exit(1); } typedef struct { int state; } event_t; static void event_init(event_t* ev) { ev->state = 0; } static void event_reset(event_t* ev) { ev->state = 0; } static void event_set(event_t* ev) { if (ev->state) exit(1); __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000); } static void event_wait(event_t* ev) { while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); } static int event_isset(event_t* ev) { return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); } static int event_timedwait(event_t* ev, uint64_t timeout) { uint64_t start = current_time_ms(); uint64_t now = start; for (;;) { uint64_t remain = timeout - (now - start); struct timespec ts; ts.tv_sec = remain / 1000; ts.tv_nsec = (remain % 1000) * 1000 * 1000; syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) return 1; now = current_time_ms(); if (now - start > timeout) return 0; } } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } struct nlmsg { char* pos; int nesting; struct nlattr* nested[8]; char buf[4096]; }; static void netlink_init(struct nlmsg* nlmsg, int typ, int flags, const void* data, int size) { memset(nlmsg, 0, sizeof(*nlmsg)); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_type = typ; hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags; memcpy(hdr + 1, data, size); nlmsg->pos = (char*)(hdr + 1) + NLMSG_ALIGN(size); } static void netlink_attr(struct nlmsg* nlmsg, int typ, const void* data, int size) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; if (size > 0) memcpy(attr + 1, data, size); nlmsg->pos += NLMSG_ALIGN(attr->nla_len); } static void netlink_nest(struct nlmsg* nlmsg, int typ) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_type = typ; nlmsg->pos += sizeof(*attr); nlmsg->nested[nlmsg->nesting++] = attr; } static void netlink_done(struct nlmsg* nlmsg) { struct nlattr* attr = nlmsg->nested[--nlmsg->nesting]; attr->nla_len = nlmsg->pos - (char*)attr; } static int netlink_send_ext(struct nlmsg* nlmsg, int sock, uint16_t reply_type, int* reply_len) { if (nlmsg->pos > nlmsg->buf + sizeof(nlmsg->buf) || nlmsg->nesting) exit(1); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf; hdr->nlmsg_len = nlmsg->pos - nlmsg->buf; struct sockaddr_nl addr; memset(&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; unsigned n = sendto(sock, nlmsg->buf, hdr->nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr)); if (n != hdr->nlmsg_len) exit(1); n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); if (reply_len) *reply_len = 0; if (hdr->nlmsg_type == NLMSG_DONE) return 0; if (n < sizeof(struct nlmsghdr)) exit(1); if (reply_len && hdr->nlmsg_type == reply_type) { *reply_len = n; return 0; } if (n < sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr)) exit(1); if (hdr->nlmsg_type != NLMSG_ERROR) exit(1); return ((struct nlmsgerr*)(hdr + 1))->error; } static int netlink_send(struct nlmsg* nlmsg, int sock) { return netlink_send_ext(nlmsg, sock, 0, NULL); } static int netlink_query_family_id(struct nlmsg* nlmsg, int sock, const char* family_name) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = CTRL_CMD_GETFAMILY; netlink_init(nlmsg, GENL_ID_CTRL, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, CTRL_ATTR_FAMILY_NAME, family_name, strnlen(family_name, GENL_NAMSIZ - 1) + 1); int n = 0; int err = netlink_send_ext(nlmsg, sock, GENL_ID_CTRL, &n); if (err < 0) { return -1; } uint16_t id = 0; struct nlattr* attr = (struct nlattr*)(nlmsg->buf + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg->buf + n; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == CTRL_ATTR_FAMILY_ID) { id = *(uint16_t*)(attr + 1); break; } } if (!id) { return -1; } recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); return id; } static int netlink_next_msg(struct nlmsg* nlmsg, unsigned int offset, unsigned int total_len) { struct nlmsghdr* hdr = (struct nlmsghdr*)(nlmsg->buf + offset); if (offset == total_len || offset + hdr->nlmsg_len > total_len) return -1; return hdr->nlmsg_len; } static void netlink_add_device_impl(struct nlmsg* nlmsg, const char* type, const char* name) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); netlink_init(nlmsg, RTM_NEWLINK, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); if (name) netlink_attr(nlmsg, IFLA_IFNAME, name, strlen(name)); netlink_nest(nlmsg, IFLA_LINKINFO); netlink_attr(nlmsg, IFLA_INFO_KIND, type, strlen(type)); } static void netlink_add_device(struct nlmsg* nlmsg, int sock, const char* type, const char* name) { netlink_add_device_impl(nlmsg, type, name); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_veth(struct nlmsg* nlmsg, int sock, const char* name, const char* peer) { netlink_add_device_impl(nlmsg, "veth", name); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_nest(nlmsg, VETH_INFO_PEER); nlmsg->pos += sizeof(struct ifinfomsg); netlink_attr(nlmsg, IFLA_IFNAME, peer, strlen(peer)); netlink_done(nlmsg); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_hsr(struct nlmsg* nlmsg, int sock, const char* name, const char* slave1, const char* slave2) { netlink_add_device_impl(nlmsg, "hsr", name); netlink_nest(nlmsg, IFLA_INFO_DATA); int ifindex1 = if_nametoindex(slave1); netlink_attr(nlmsg, IFLA_HSR_SLAVE1, &ifindex1, sizeof(ifindex1)); int ifindex2 = if_nametoindex(slave2); netlink_attr(nlmsg, IFLA_HSR_SLAVE2, &ifindex2, sizeof(ifindex2)); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_linked(struct nlmsg* nlmsg, int sock, const char* type, const char* name, const char* link) { netlink_add_device_impl(nlmsg, type, name); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_vlan(struct nlmsg* nlmsg, int sock, const char* name, const char* link, uint16_t id, uint16_t proto) { netlink_add_device_impl(nlmsg, "vlan", name); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_attr(nlmsg, IFLA_VLAN_ID, &id, sizeof(id)); netlink_attr(nlmsg, IFLA_VLAN_PROTOCOL, &proto, sizeof(proto)); netlink_done(nlmsg); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_macvlan(struct nlmsg* nlmsg, int sock, const char* name, const char* link) { netlink_add_device_impl(nlmsg, "macvlan", name); netlink_nest(nlmsg, IFLA_INFO_DATA); uint32_t mode = MACVLAN_MODE_BRIDGE; netlink_attr(nlmsg, IFLA_MACVLAN_MODE, &mode, sizeof(mode)); netlink_done(nlmsg); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_add_geneve(struct nlmsg* nlmsg, int sock, const char* name, uint32_t vni, struct in_addr* addr4, struct in6_addr* addr6) { netlink_add_device_impl(nlmsg, "geneve", name); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_attr(nlmsg, IFLA_GENEVE_ID, &vni, sizeof(vni)); if (addr4) netlink_attr(nlmsg, IFLA_GENEVE_REMOTE, addr4, sizeof(*addr4)); if (addr6) netlink_attr(nlmsg, IFLA_GENEVE_REMOTE6, addr6, sizeof(*addr6)); netlink_done(nlmsg); netlink_done(nlmsg); int err = netlink_send(nlmsg, sock); (void)err; } #define IFLA_IPVLAN_FLAGS 2 #define IPVLAN_MODE_L3S 2 #undef IPVLAN_F_VEPA #define IPVLAN_F_VEPA 2 static void netlink_add_ipvlan(struct nlmsg* nlmsg, int sock, const char* name, const char* link, uint16_t mode, uint16_t flags) { netlink_add_device_impl(nlmsg, "ipvlan", name); netlink_nest(nlmsg, IFLA_INFO_DATA); netlink_attr(nlmsg, IFLA_IPVLAN_MODE, &mode, sizeof(mode)); netlink_attr(nlmsg, IFLA_IPVLAN_FLAGS, &flags, sizeof(flags)); netlink_done(nlmsg); netlink_done(nlmsg); int ifindex = if_nametoindex(link); netlink_attr(nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(nlmsg, sock); (void)err; } static void netlink_device_change(struct nlmsg* nlmsg, int sock, const char* name, bool up, const char* master, const void* mac, int macsize, const char* new_name) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); if (up) hdr.ifi_flags = hdr.ifi_change = IFF_UP; hdr.ifi_index = if_nametoindex(name); netlink_init(nlmsg, RTM_NEWLINK, 0, &hdr, sizeof(hdr)); if (new_name) netlink_attr(nlmsg, IFLA_IFNAME, new_name, strlen(new_name)); if (master) { int ifindex = if_nametoindex(master); netlink_attr(nlmsg, IFLA_MASTER, &ifindex, sizeof(ifindex)); } if (macsize) netlink_attr(nlmsg, IFLA_ADDRESS, mac, macsize); int err = netlink_send(nlmsg, sock); (void)err; } static int netlink_add_addr(struct nlmsg* nlmsg, int sock, const char* dev, const void* addr, int addrsize) { struct ifaddrmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ifa_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ifa_prefixlen = addrsize == 4 ? 24 : 120; hdr.ifa_scope = RT_SCOPE_UNIVERSE; hdr.ifa_index = if_nametoindex(dev); netlink_init(nlmsg, RTM_NEWADDR, NLM_F_CREATE | NLM_F_REPLACE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, IFA_LOCAL, addr, addrsize); netlink_attr(nlmsg, IFA_ADDRESS, addr, addrsize); return netlink_send(nlmsg, sock); } static void netlink_add_addr4(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in_addr in_addr; inet_pton(AF_INET, addr, &in_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in_addr, sizeof(in_addr)); (void)err; } static void netlink_add_addr6(struct nlmsg* nlmsg, int sock, const char* dev, const char* addr) { struct in6_addr in6_addr; inet_pton(AF_INET6, addr, &in6_addr); int err = netlink_add_addr(nlmsg, sock, dev, &in6_addr, sizeof(in6_addr)); (void)err; } static void netlink_add_neigh(struct nlmsg* nlmsg, int sock, const char* name, const void* addr, int addrsize, const void* mac, int macsize) { struct ndmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ndm_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ndm_ifindex = if_nametoindex(name); hdr.ndm_state = NUD_PERMANENT; netlink_init(nlmsg, RTM_NEWNEIGH, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); netlink_attr(nlmsg, NDA_DST, addr, addrsize); netlink_attr(nlmsg, NDA_LLADDR, mac, macsize); int err = netlink_send(nlmsg, sock); (void)err; } static struct nlmsg nlmsg; static int tunfd = -1; #define TUN_IFACE "syz_tun" #define LOCAL_MAC 0xaaaaaaaaaaaa #define REMOTE_MAC 0xaaaaaaaaaabb #define LOCAL_IPV4 "172.20.20.170" #define REMOTE_IPV4 "172.20.20.187" #define LOCAL_IPV6 "fe80::aa" #define REMOTE_IPV6 "fe80::bb" #define IFF_NAPI 0x0010 static void initialize_tun(void) { tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK); if (tunfd == -1) { printf("tun: can't open /dev/net/tun: please enable CONFIG_TUN=y\n"); printf("otherwise fuzzing or reproducing might not work as intended\n"); return; } const int kTunFd = 240; if (dup2(tunfd, kTunFd) < 0) exit(1); close(tunfd); tunfd = kTunFd; struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, TUN_IFACE, IFNAMSIZ); ifr.ifr_flags = IFF_TAP | IFF_NO_PI; if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) { exit(1); } char sysctl[64]; sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/accept_dad", TUN_IFACE); write_file(sysctl, "0"); sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/router_solicitations", TUN_IFACE); write_file(sysctl, "0"); int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); netlink_add_addr4(&nlmsg, sock, TUN_IFACE, LOCAL_IPV4); netlink_add_addr6(&nlmsg, sock, TUN_IFACE, LOCAL_IPV6); uint64_t macaddr = REMOTE_MAC; struct in_addr in_addr; inet_pton(AF_INET, REMOTE_IPV4, &in_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in_addr, sizeof(in_addr), &macaddr, ETH_ALEN); struct in6_addr in6_addr; inet_pton(AF_INET6, REMOTE_IPV6, &in6_addr); netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in6_addr, sizeof(in6_addr), &macaddr, ETH_ALEN); macaddr = LOCAL_MAC; netlink_device_change(&nlmsg, sock, TUN_IFACE, true, 0, &macaddr, ETH_ALEN, NULL); close(sock); } #define DEVLINK_FAMILY_NAME "devlink" #define DEVLINK_CMD_PORT_GET 5 #define DEVLINK_ATTR_BUS_NAME 1 #define DEVLINK_ATTR_DEV_NAME 2 #define DEVLINK_ATTR_NETDEV_NAME 7 static struct nlmsg nlmsg2; static void initialize_devlink_ports(const char* bus_name, const char* dev_name, const char* netdev_prefix) { struct genlmsghdr genlhdr; int len, total_len, id, err, offset; uint16_t netdev_index; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock == -1) exit(1); int rtsock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (rtsock == -1) exit(1); id = netlink_query_family_id(&nlmsg, sock, DEVLINK_FAMILY_NAME); if (id == -1) goto error; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = DEVLINK_CMD_PORT_GET; netlink_init(&nlmsg, id, NLM_F_DUMP, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, DEVLINK_ATTR_BUS_NAME, bus_name, strlen(bus_name) + 1); netlink_attr(&nlmsg, DEVLINK_ATTR_DEV_NAME, dev_name, strlen(dev_name) + 1); err = netlink_send_ext(&nlmsg, sock, id, &total_len); if (err < 0) { goto error; } offset = 0; netdev_index = 0; while ((len = netlink_next_msg(&nlmsg, offset, total_len)) != -1) { struct nlattr* attr = (struct nlattr*)(nlmsg.buf + offset + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg.buf + offset + len; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == DEVLINK_ATTR_NETDEV_NAME) { char* port_name; char netdev_name[IFNAMSIZ]; port_name = (char*)(attr + 1); snprintf(netdev_name, sizeof(netdev_name), "%s%d", netdev_prefix, netdev_index); netlink_device_change(&nlmsg2, rtsock, port_name, true, 0, 0, 0, netdev_name); break; } } offset += len; netdev_index++; } error: close(rtsock); close(sock); } #define WIFI_INITIAL_DEVICE_COUNT 2 #define WIFI_MAC_BASE \ { \ 0x08, 0x02, 0x11, 0x00, 0x00, 0x00 \ } #define WIFI_IBSS_BSSID \ { \ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50 \ } #define WIFI_IBSS_SSID \ { \ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 \ } #define WIFI_DEFAULT_FREQUENCY 2412 #define WIFI_DEFAULT_SIGNAL 0 #define WIFI_DEFAULT_RX_RATE 1 #define HWSIM_CMD_REGISTER 1 #define HWSIM_CMD_FRAME 2 #define HWSIM_CMD_NEW_RADIO 4 #define HWSIM_ATTR_SUPPORT_P2P_DEVICE 14 #define HWSIM_ATTR_PERM_ADDR 22 #define IF_OPER_UP 6 struct join_ibss_props { int wiphy_freq; bool wiphy_freq_fixed; uint8_t* mac; uint8_t* ssid; int ssid_len; }; static int set_interface_state(const char* interface_name, int on) { struct ifreq ifr; int sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) { return -1; } memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, interface_name); int ret = ioctl(sock, SIOCGIFFLAGS, &ifr); if (ret < 0) { close(sock); return -1; } if (on) ifr.ifr_flags |= IFF_UP; else ifr.ifr_flags &= ~IFF_UP; ret = ioctl(sock, SIOCSIFFLAGS, &ifr); close(sock); if (ret < 0) { return -1; } return 0; } static int nl80211_set_interface(struct nlmsg* nlmsg, int sock, int nl80211_family, uint32_t ifindex, uint32_t iftype) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = NL80211_CMD_SET_INTERFACE; netlink_init(nlmsg, nl80211_family, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, NL80211_ATTR_IFINDEX, &ifindex, sizeof(ifindex)); netlink_attr(nlmsg, NL80211_ATTR_IFTYPE, &iftype, sizeof(iftype)); int err = netlink_send(nlmsg, sock); if (err < 0) { return -1; } return 0; } static int nl80211_join_ibss(struct nlmsg* nlmsg, int sock, int nl80211_family, uint32_t ifindex, struct join_ibss_props* props) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = NL80211_CMD_JOIN_IBSS; netlink_init(nlmsg, nl80211_family, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, NL80211_ATTR_IFINDEX, &ifindex, sizeof(ifindex)); netlink_attr(nlmsg, NL80211_ATTR_SSID, props->ssid, props->ssid_len); netlink_attr(nlmsg, NL80211_ATTR_WIPHY_FREQ, &(props->wiphy_freq), sizeof(props->wiphy_freq)); if (props->mac) netlink_attr(nlmsg, NL80211_ATTR_MAC, props->mac, ETH_ALEN); if (props->wiphy_freq_fixed) netlink_attr(nlmsg, NL80211_ATTR_FREQ_FIXED, NULL, 0); int err = netlink_send(nlmsg, sock); if (err < 0) { return -1; } return 0; } static int get_ifla_operstate(struct nlmsg* nlmsg, int ifindex) { struct ifinfomsg info; memset(&info, 0, sizeof(info)); info.ifi_family = AF_UNSPEC; info.ifi_index = ifindex; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) { return -1; } netlink_init(nlmsg, RTM_GETLINK, 0, &info, sizeof(info)); int n; int err = netlink_send_ext(nlmsg, sock, RTM_NEWLINK, &n); close(sock); if (err) { return -1; } struct rtattr* attr = IFLA_RTA(NLMSG_DATA(nlmsg->buf)); for (; RTA_OK(attr, n); attr = RTA_NEXT(attr, n)) { if (attr->rta_type == IFLA_OPERSTATE) return *((int32_t*)RTA_DATA(attr)); } return -1; } static int await_ifla_operstate(struct nlmsg* nlmsg, char* interface, int operstate) { int ifindex = if_nametoindex(interface); while (true) { usleep(1000); int ret = get_ifla_operstate(nlmsg, ifindex); if (ret < 0) return ret; if (ret == operstate) return 0; } return 0; } static int nl80211_setup_ibss_interface(struct nlmsg* nlmsg, int sock, int nl80211_family_id, char* interface, struct join_ibss_props* ibss_props) { int ifindex = if_nametoindex(interface); if (ifindex == 0) { return -1; } int ret = nl80211_set_interface(nlmsg, sock, nl80211_family_id, ifindex, NL80211_IFTYPE_ADHOC); if (ret < 0) { return -1; } ret = set_interface_state(interface, 1); if (ret < 0) { return -1; } ret = nl80211_join_ibss(nlmsg, sock, nl80211_family_id, ifindex, ibss_props); if (ret < 0) { return -1; } return 0; } static int hwsim80211_create_device(struct nlmsg* nlmsg, int sock, int hwsim_family, uint8_t mac_addr[ETH_ALEN]) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = HWSIM_CMD_NEW_RADIO; netlink_init(nlmsg, hwsim_family, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, HWSIM_ATTR_SUPPORT_P2P_DEVICE, NULL, 0); netlink_attr(nlmsg, HWSIM_ATTR_PERM_ADDR, mac_addr, ETH_ALEN); int err = netlink_send(nlmsg, sock); if (err < 0) { return -1; } return 0; } static void initialize_wifi_devices(void) { uint8_t mac_addr[6] = WIFI_MAC_BASE; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock < 0) { return; } int hwsim_family_id = netlink_query_family_id(&nlmsg, sock, "MAC80211_HWSIM"); int nl80211_family_id = netlink_query_family_id(&nlmsg, sock, "nl80211"); uint8_t ssid[] = WIFI_IBSS_SSID; uint8_t bssid[] = WIFI_IBSS_BSSID; struct join_ibss_props ibss_props = {.wiphy_freq = WIFI_DEFAULT_FREQUENCY, .wiphy_freq_fixed = true, .mac = bssid, .ssid = ssid, .ssid_len = sizeof(ssid)}; for (int device_id = 0; device_id < WIFI_INITIAL_DEVICE_COUNT; device_id++) { mac_addr[5] = device_id; int ret = hwsim80211_create_device(&nlmsg, sock, hwsim_family_id, mac_addr); if (ret < 0) exit(1); char interface[6] = "wlan0"; interface[4] += device_id; if (nl80211_setup_ibss_interface(&nlmsg, sock, nl80211_family_id, interface, &ibss_props) < 0) exit(1); } for (int device_id = 0; device_id < WIFI_INITIAL_DEVICE_COUNT; device_id++) { char interface[6] = "wlan0"; interface[4] += device_id; int ret = await_ifla_operstate(&nlmsg, interface, IF_OPER_UP); if (ret < 0) exit(1); } close(sock); } #define DEV_IPV4 "172.20.20.%d" #define DEV_IPV6 "fe80::%02x" #define DEV_MAC 0x00aaaaaaaaaa static void netdevsim_add(unsigned int addr, unsigned int port_count) { char buf[16]; sprintf(buf, "%u %u", addr, port_count); if (write_file("/sys/bus/netdevsim/new_device", buf)) { snprintf(buf, sizeof(buf), "netdevsim%d", addr); initialize_devlink_ports("netdevsim", buf, "netdevsim"); } } #define WG_GENL_NAME "wireguard" enum wg_cmd { WG_CMD_GET_DEVICE, WG_CMD_SET_DEVICE, }; enum wgdevice_attribute { WGDEVICE_A_UNSPEC, WGDEVICE_A_IFINDEX, WGDEVICE_A_IFNAME, WGDEVICE_A_PRIVATE_KEY, WGDEVICE_A_PUBLIC_KEY, WGDEVICE_A_FLAGS, WGDEVICE_A_LISTEN_PORT, WGDEVICE_A_FWMARK, WGDEVICE_A_PEERS, }; enum wgpeer_attribute { WGPEER_A_UNSPEC, WGPEER_A_PUBLIC_KEY, WGPEER_A_PRESHARED_KEY, WGPEER_A_FLAGS, WGPEER_A_ENDPOINT, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, WGPEER_A_LAST_HANDSHAKE_TIME, WGPEER_A_RX_BYTES, WGPEER_A_TX_BYTES, WGPEER_A_ALLOWEDIPS, WGPEER_A_PROTOCOL_VERSION, }; enum wgallowedip_attribute { WGALLOWEDIP_A_UNSPEC, WGALLOWEDIP_A_FAMILY, WGALLOWEDIP_A_IPADDR, WGALLOWEDIP_A_CIDR_MASK, }; static void netlink_wireguard_setup(void) { const char ifname_a[] = "wg0"; const char ifname_b[] = "wg1"; const char ifname_c[] = "wg2"; const char private_a[] = "\xa0\x5c\xa8\x4f\x6c\x9c\x8e\x38\x53\xe2\xfd\x7a" "\x70\xae\x0f\xb2\x0f\xa1\x52\x60\x0c\xb0\x08\x45" "\x17\x4f\x08\x07\x6f\x8d\x78\x43"; const char private_b[] = "\xb0\x80\x73\xe8\xd4\x4e\x91\xe3\xda\x92\x2c\x22" "\x43\x82\x44\xbb\x88\x5c\x69\xe2\x69\xc8\xe9\xd8" "\x35\xb1\x14\x29\x3a\x4d\xdc\x6e"; const char private_c[] = "\xa0\xcb\x87\x9a\x47\xf5\xbc\x64\x4c\x0e\x69\x3f" "\xa6\xd0\x31\xc7\x4a\x15\x53\xb6\xe9\x01\xb9\xff" "\x2f\x51\x8c\x78\x04\x2f\xb5\x42"; const char public_a[] = "\x97\x5c\x9d\x81\xc9\x83\xc8\x20\x9e\xe7\x81\x25\x4b" "\x89\x9f\x8e\xd9\x25\xae\x9f\x09\x23\xc2\x3c\x62\xf5" "\x3c\x57\xcd\xbf\x69\x1c"; const char public_b[] = "\xd1\x73\x28\x99\xf6\x11\xcd\x89\x94\x03\x4d\x7f\x41" "\x3d\xc9\x57\x63\x0e\x54\x93\xc2\x85\xac\xa4\x00\x65" "\xcb\x63\x11\xbe\x69\x6b"; const char public_c[] = "\xf4\x4d\xa3\x67\xa8\x8e\xe6\x56\x4f\x02\x02\x11\x45" "\x67\x27\x08\x2f\x5c\xeb\xee\x8b\x1b\xf5\xeb\x73\x37" "\x34\x1b\x45\x9b\x39\x22"; const uint16_t listen_a = 20001; const uint16_t listen_b = 20002; const uint16_t listen_c = 20003; const uint16_t af_inet = AF_INET; const uint16_t af_inet6 = AF_INET6; const struct sockaddr_in endpoint_b_v4 = { .sin_family = AF_INET, .sin_port = htons(listen_b), .sin_addr = {htonl(INADDR_LOOPBACK)}}; const struct sockaddr_in endpoint_c_v4 = { .sin_family = AF_INET, .sin_port = htons(listen_c), .sin_addr = {htonl(INADDR_LOOPBACK)}}; struct sockaddr_in6 endpoint_a_v6 = {.sin6_family = AF_INET6, .sin6_port = htons(listen_a)}; endpoint_a_v6.sin6_addr = in6addr_loopback; struct sockaddr_in6 endpoint_c_v6 = {.sin6_family = AF_INET6, .sin6_port = htons(listen_c)}; endpoint_c_v6.sin6_addr = in6addr_loopback; const struct in_addr first_half_v4 = {0}; const struct in_addr second_half_v4 = {(uint32_t)htonl(128 << 24)}; const struct in6_addr first_half_v6 = {{{0}}}; const struct in6_addr second_half_v6 = {{{0x80}}}; const uint8_t half_cidr = 1; const uint16_t persistent_keepalives[] = {1, 3, 7, 9, 14, 19}; struct genlmsghdr genlhdr = {.cmd = WG_CMD_SET_DEVICE, .version = 1}; int sock; int id, err; sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock == -1) { return; } id = netlink_query_family_id(&nlmsg, sock, WG_GENL_NAME); if (id == -1) goto error; netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, WGDEVICE_A_IFNAME, ifname_a, strlen(ifname_a) + 1); netlink_attr(&nlmsg, WGDEVICE_A_PRIVATE_KEY, private_a, 32); netlink_attr(&nlmsg, WGDEVICE_A_LISTEN_PORT, &listen_a, 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGDEVICE_A_PEERS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_b, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_b_v4, sizeof(endpoint_b_v4)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[0], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v4, sizeof(first_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v6, sizeof(first_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_c, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_c_v6, sizeof(endpoint_c_v6)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[1], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v4, sizeof(second_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v6, sizeof(second_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); err = netlink_send(&nlmsg, sock); if (err < 0) { } netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, WGDEVICE_A_IFNAME, ifname_b, strlen(ifname_b) + 1); netlink_attr(&nlmsg, WGDEVICE_A_PRIVATE_KEY, private_b, 32); netlink_attr(&nlmsg, WGDEVICE_A_LISTEN_PORT, &listen_b, 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGDEVICE_A_PEERS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_a, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_a_v6, sizeof(endpoint_a_v6)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[2], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v4, sizeof(first_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v6, sizeof(first_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_c, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_c_v4, sizeof(endpoint_c_v4)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[3], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v4, sizeof(second_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v6, sizeof(second_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); err = netlink_send(&nlmsg, sock); if (err < 0) { } netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, WGDEVICE_A_IFNAME, ifname_c, strlen(ifname_c) + 1); netlink_attr(&nlmsg, WGDEVICE_A_PRIVATE_KEY, private_c, 32); netlink_attr(&nlmsg, WGDEVICE_A_LISTEN_PORT, &listen_c, 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGDEVICE_A_PEERS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_a, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_a_v6, sizeof(endpoint_a_v6)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[4], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v4, sizeof(first_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &first_half_v6, sizeof(first_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGPEER_A_PUBLIC_KEY, public_b, 32); netlink_attr(&nlmsg, WGPEER_A_ENDPOINT, &endpoint_b_v4, sizeof(endpoint_b_v4)); netlink_attr(&nlmsg, WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, &persistent_keepalives[5], 2); netlink_nest(&nlmsg, NLA_F_NESTED | WGPEER_A_ALLOWEDIPS); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v4, sizeof(second_half_v4)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_nest(&nlmsg, NLA_F_NESTED | 0); netlink_attr(&nlmsg, WGALLOWEDIP_A_FAMILY, &af_inet6, 2); netlink_attr(&nlmsg, WGALLOWEDIP_A_IPADDR, &second_half_v6, sizeof(second_half_v6)); netlink_attr(&nlmsg, WGALLOWEDIP_A_CIDR_MASK, &half_cidr, 1); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); netlink_done(&nlmsg); err = netlink_send(&nlmsg, sock); if (err < 0) { } error: close(sock); } static void initialize_netdevices(void) { char netdevsim[16]; sprintf(netdevsim, "netdevsim%d", (int)procid); struct { const char* type; const char* dev; } devtypes[] = { {"ip6gretap", "ip6gretap0"}, {"bridge", "bridge0"}, {"vcan", "vcan0"}, {"bond", "bond0"}, {"team", "team0"}, {"dummy", "dummy0"}, {"nlmon", "nlmon0"}, {"caif", "caif0"}, {"batadv", "batadv0"}, {"vxcan", "vxcan1"}, {"netdevsim", netdevsim}, {"veth", 0}, {"xfrm", "xfrm0"}, {"wireguard", "wg0"}, {"wireguard", "wg1"}, {"wireguard", "wg2"}, }; const char* devmasters[] = {"bridge", "bond", "team", "batadv"}; struct { const char* name; int macsize; bool noipv6; } devices[] = { {"lo", ETH_ALEN}, {"sit0", 0}, {"bridge0", ETH_ALEN}, {"vcan0", 0, true}, {"tunl0", 0}, {"gre0", 0}, {"gretap0", ETH_ALEN}, {"ip_vti0", 0}, {"ip6_vti0", 0}, {"ip6tnl0", 0}, {"ip6gre0", 0}, {"ip6gretap0", ETH_ALEN}, {"erspan0", ETH_ALEN}, {"bond0", ETH_ALEN}, {"veth0", ETH_ALEN}, {"veth1", ETH_ALEN}, {"team0", ETH_ALEN}, {"veth0_to_bridge", ETH_ALEN}, {"veth1_to_bridge", ETH_ALEN}, {"veth0_to_bond", ETH_ALEN}, {"veth1_to_bond", ETH_ALEN}, {"veth0_to_team", ETH_ALEN}, {"veth1_to_team", ETH_ALEN}, {"veth0_to_hsr", ETH_ALEN}, {"veth1_to_hsr", ETH_ALEN}, {"hsr0", 0}, {"dummy0", ETH_ALEN}, {"nlmon0", 0}, {"vxcan0", 0, true}, {"vxcan1", 0, true}, {"caif0", ETH_ALEN}, {"batadv0", ETH_ALEN}, {netdevsim, ETH_ALEN}, {"xfrm0", ETH_ALEN}, {"veth0_virt_wifi", ETH_ALEN}, {"veth1_virt_wifi", ETH_ALEN}, {"virt_wifi0", ETH_ALEN}, {"veth0_vlan", ETH_ALEN}, {"veth1_vlan", ETH_ALEN}, {"vlan0", ETH_ALEN}, {"vlan1", ETH_ALEN}, {"macvlan0", ETH_ALEN}, {"macvlan1", ETH_ALEN}, {"ipvlan0", ETH_ALEN}, {"ipvlan1", ETH_ALEN}, {"veth0_macvtap", ETH_ALEN}, {"veth1_macvtap", ETH_ALEN}, {"macvtap0", ETH_ALEN}, {"macsec0", ETH_ALEN}, {"veth0_to_batadv", ETH_ALEN}, {"veth1_to_batadv", ETH_ALEN}, {"batadv_slave_0", ETH_ALEN}, {"batadv_slave_1", ETH_ALEN}, {"geneve0", ETH_ALEN}, {"geneve1", ETH_ALEN}, {"wg0", 0}, {"wg1", 0}, {"wg2", 0}, }; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); unsigned i; for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++) netlink_add_device(&nlmsg, sock, devtypes[i].type, devtypes[i].dev); for (i = 0; i < sizeof(devmasters) / (sizeof(devmasters[0])); i++) { char master[32], slave0[32], veth0[32], slave1[32], veth1[32]; sprintf(slave0, "%s_slave_0", devmasters[i]); sprintf(veth0, "veth0_to_%s", devmasters[i]); netlink_add_veth(&nlmsg, sock, slave0, veth0); sprintf(slave1, "%s_slave_1", devmasters[i]); sprintf(veth1, "veth1_to_%s", devmasters[i]); netlink_add_veth(&nlmsg, sock, slave1, veth1); sprintf(master, "%s0", devmasters[i]); netlink_device_change(&nlmsg, sock, slave0, false, master, 0, 0, NULL); netlink_device_change(&nlmsg, sock, slave1, false, master, 0, 0, NULL); } netlink_device_change(&nlmsg, sock, "bridge_slave_0", true, 0, 0, 0, NULL); netlink_device_change(&nlmsg, sock, "bridge_slave_1", true, 0, 0, 0, NULL); netlink_add_veth(&nlmsg, sock, "hsr_slave_0", "veth0_to_hsr"); netlink_add_veth(&nlmsg, sock, "hsr_slave_1", "veth1_to_hsr"); netlink_add_hsr(&nlmsg, sock, "hsr0", "hsr_slave_0", "hsr_slave_1"); netlink_device_change(&nlmsg, sock, "hsr_slave_0", true, 0, 0, 0, NULL); netlink_device_change(&nlmsg, sock, "hsr_slave_1", true, 0, 0, 0, NULL); netlink_add_veth(&nlmsg, sock, "veth0_virt_wifi", "veth1_virt_wifi"); netlink_add_linked(&nlmsg, sock, "virt_wifi", "virt_wifi0", "veth1_virt_wifi"); netlink_add_veth(&nlmsg, sock, "veth0_vlan", "veth1_vlan"); netlink_add_vlan(&nlmsg, sock, "vlan0", "veth0_vlan", 0, htons(ETH_P_8021Q)); netlink_add_vlan(&nlmsg, sock, "vlan1", "veth0_vlan", 1, htons(ETH_P_8021AD)); netlink_add_macvlan(&nlmsg, sock, "macvlan0", "veth1_vlan"); netlink_add_macvlan(&nlmsg, sock, "macvlan1", "veth1_vlan"); netlink_add_ipvlan(&nlmsg, sock, "ipvlan0", "veth0_vlan", IPVLAN_MODE_L2, 0); netlink_add_ipvlan(&nlmsg, sock, "ipvlan1", "veth0_vlan", IPVLAN_MODE_L3S, IPVLAN_F_VEPA); netlink_add_veth(&nlmsg, sock, "veth0_macvtap", "veth1_macvtap"); netlink_add_linked(&nlmsg, sock, "macvtap", "macvtap0", "veth0_macvtap"); netlink_add_linked(&nlmsg, sock, "macsec", "macsec0", "veth1_macvtap"); char addr[32]; sprintf(addr, DEV_IPV4, 14 + 10); struct in_addr geneve_addr4; if (inet_pton(AF_INET, addr, &geneve_addr4) <= 0) exit(1); struct in6_addr geneve_addr6; if (inet_pton(AF_INET6, "fc00::01", &geneve_addr6) <= 0) exit(1); netlink_add_geneve(&nlmsg, sock, "geneve0", 0, &geneve_addr4, 0); netlink_add_geneve(&nlmsg, sock, "geneve1", 1, 0, &geneve_addr6); netdevsim_add((int)procid, 4); netlink_wireguard_setup(); for (i = 0; i < sizeof(devices) / (sizeof(devices[0])); i++) { char addr[32]; sprintf(addr, DEV_IPV4, i + 10); netlink_add_addr4(&nlmsg, sock, devices[i].name, addr); if (!devices[i].noipv6) { sprintf(addr, DEV_IPV6, i + 10); netlink_add_addr6(&nlmsg, sock, devices[i].name, addr); } uint64_t macaddr = DEV_MAC + ((i + 10ull) << 40); netlink_device_change(&nlmsg, sock, devices[i].name, true, 0, &macaddr, devices[i].macsize, NULL); } close(sock); } static void initialize_netdevices_init(void) { int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); struct { const char* type; int macsize; bool noipv6; bool noup; } devtypes[] = { {"nr", 7, true}, {"rose", 5, true, true}, }; unsigned i; for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++) { char dev[32], addr[32]; sprintf(dev, "%s%d", devtypes[i].type, (int)procid); sprintf(addr, "172.30.%d.%d", i, (int)procid + 1); netlink_add_addr4(&nlmsg, sock, dev, addr); if (!devtypes[i].noipv6) { sprintf(addr, "fe88::%02x:%02x", i, (int)procid + 1); netlink_add_addr6(&nlmsg, sock, dev, addr); } int macsize = devtypes[i].macsize; uint64_t macaddr = 0xbbbbbb + ((unsigned long long)i << (8 * (macsize - 2))) + (procid << (8 * (macsize - 1))); netlink_device_change(&nlmsg, sock, dev, !devtypes[i].noup, 0, &macaddr, macsize, NULL); } close(sock); } static int read_tun(char* data, int size) { if (tunfd < 0) return -1; int rv = read(tunfd, data, size); if (rv < 0) { if (errno == EAGAIN || errno == EBADFD) return -1; exit(1); } return rv; } #define VHCI_HC_PORTS 8 #define VHCI_PORTS (VHCI_HC_PORTS * 2) static long syz_usbip_server_init(volatile long a0) { int socket_pair[2]; char buffer[100]; static int port_alloc[2]; int speed = (int)a0; bool usb3 = (speed == USB_SPEED_SUPER); int rc = socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair); if (rc < 0) exit(1); int client_fd = socket_pair[0]; int server_fd = socket_pair[1]; int available_port_num = __atomic_fetch_add(&port_alloc[usb3], 1, __ATOMIC_RELAXED); if (available_port_num > VHCI_HC_PORTS) { return -1; } int port_num = procid * VHCI_PORTS + usb3 * VHCI_HC_PORTS + available_port_num; sprintf(buffer, "%d %d %s %d", port_num, client_fd, "0", speed); write_file("/sys/devices/platform/vhci_hcd.0/attach", buffer); return server_fd; } static void flush_tun() { char data[1000]; while (read_tun(&data[0], sizeof(data)) != -1) { } } #define MAX_FDS 30 #define BTPROTO_HCI 1 #define ACL_LINK 1 #define SCAN_PAGE 2 typedef struct { uint8_t b[6]; } __attribute__((packed)) bdaddr_t; #define HCI_COMMAND_PKT 1 #define HCI_EVENT_PKT 4 #define HCI_VENDOR_PKT 0xff struct hci_command_hdr { uint16_t opcode; uint8_t plen; } __attribute__((packed)); struct hci_event_hdr { uint8_t evt; uint8_t plen; } __attribute__((packed)); #define HCI_EV_CONN_COMPLETE 0x03 struct hci_ev_conn_complete { uint8_t status; uint16_t handle; bdaddr_t bdaddr; uint8_t link_type; uint8_t encr_mode; } __attribute__((packed)); #define HCI_EV_CONN_REQUEST 0x04 struct hci_ev_conn_request { bdaddr_t bdaddr; uint8_t dev_class[3]; uint8_t link_type; } __attribute__((packed)); #define HCI_EV_REMOTE_FEATURES 0x0b struct hci_ev_remote_features { uint8_t status; uint16_t handle; uint8_t features[8]; } __attribute__((packed)); #define HCI_EV_CMD_COMPLETE 0x0e struct hci_ev_cmd_complete { uint8_t ncmd; uint16_t opcode; } __attribute__((packed)); #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a #define HCI_OP_READ_BUFFER_SIZE 0x1005 struct hci_rp_read_buffer_size { uint8_t status; uint16_t acl_mtu; uint8_t sco_mtu; uint16_t acl_max_pkt; uint16_t sco_max_pkt; } __attribute__((packed)); #define HCI_OP_READ_BD_ADDR 0x1009 struct hci_rp_read_bd_addr { uint8_t status; bdaddr_t bdaddr; } __attribute__((packed)); #define HCI_EV_LE_META 0x3e struct hci_ev_le_meta { uint8_t subevent; } __attribute__((packed)); #define HCI_EV_LE_CONN_COMPLETE 0x01 struct hci_ev_le_conn_complete { uint8_t status; uint16_t handle; uint8_t role; uint8_t bdaddr_type; bdaddr_t bdaddr; uint16_t interval; uint16_t latency; uint16_t supervision_timeout; uint8_t clk_accurancy; } __attribute__((packed)); struct hci_dev_req { uint16_t dev_id; uint32_t dev_opt; }; struct vhci_vendor_pkt { uint8_t type; uint8_t opcode; uint16_t id; }; #define HCIDEVUP _IOW('H', 201, int) #define HCISETSCAN _IOW('H', 221, int) static int vhci_fd = -1; static void rfkill_unblock_all() { int fd = open("/dev/rfkill", O_WRONLY); if (fd < 0) exit(1); struct rfkill_event event = {0}; event.idx = 0; event.type = RFKILL_TYPE_ALL; event.op = RFKILL_OP_CHANGE_ALL; event.soft = 0; event.hard = 0; if (write(fd, &event, sizeof(event)) < 0) exit(1); close(fd); } static void hci_send_event_packet(int fd, uint8_t evt, void* data, size_t data_len) { struct iovec iv[3]; struct hci_event_hdr hdr; hdr.evt = evt; hdr.plen = data_len; uint8_t type = HCI_EVENT_PKT; iv[0].iov_base = &type; iv[0].iov_len = sizeof(type); iv[1].iov_base = &hdr; iv[1].iov_len = sizeof(hdr); iv[2].iov_base = data; iv[2].iov_len = data_len; if (writev(fd, iv, sizeof(iv) / sizeof(struct iovec)) < 0) exit(1); } static void hci_send_event_cmd_complete(int fd, uint16_t opcode, void* data, size_t data_len) { struct iovec iv[4]; struct hci_event_hdr hdr; hdr.evt = HCI_EV_CMD_COMPLETE; hdr.plen = sizeof(struct hci_ev_cmd_complete) + data_len; struct hci_ev_cmd_complete evt_hdr; evt_hdr.ncmd = 1; evt_hdr.opcode = opcode; uint8_t type = HCI_EVENT_PKT; iv[0].iov_base = &type; iv[0].iov_len = sizeof(type); iv[1].iov_base = &hdr; iv[1].iov_len = sizeof(hdr); iv[2].iov_base = &evt_hdr; iv[2].iov_len = sizeof(evt_hdr); iv[3].iov_base = data; iv[3].iov_len = data_len; if (writev(fd, iv, sizeof(iv) / sizeof(struct iovec)) < 0) exit(1); } static bool process_command_pkt(int fd, char* buf, ssize_t buf_size) { struct hci_command_hdr* hdr = (struct hci_command_hdr*)buf; if (buf_size < (ssize_t)sizeof(struct hci_command_hdr) || hdr->plen != buf_size - sizeof(struct hci_command_hdr)) { exit(1); } switch (hdr->opcode) { case HCI_OP_WRITE_SCAN_ENABLE: { uint8_t status = 0; hci_send_event_cmd_complete(fd, hdr->opcode, &status, sizeof(status)); return true; } case HCI_OP_READ_BD_ADDR: { struct hci_rp_read_bd_addr rp = {0}; rp.status = 0; memset(&rp.bdaddr, 0xaa, 6); hci_send_event_cmd_complete(fd, hdr->opcode, &rp, sizeof(rp)); return false; } case HCI_OP_READ_BUFFER_SIZE: { struct hci_rp_read_buffer_size rp = {0}; rp.status = 0; rp.acl_mtu = 1021; rp.sco_mtu = 96; rp.acl_max_pkt = 4; rp.sco_max_pkt = 6; hci_send_event_cmd_complete(fd, hdr->opcode, &rp, sizeof(rp)); return false; } } char dummy[0xf9] = {0}; hci_send_event_cmd_complete(fd, hdr->opcode, dummy, sizeof(dummy)); return false; } static void* event_thread(void* arg) { while (1) { char buf[1024] = {0}; ssize_t buf_size = read(vhci_fd, buf, sizeof(buf)); if (buf_size < 0) exit(1); if (buf_size > 0 && buf[0] == HCI_COMMAND_PKT) { if (process_command_pkt(vhci_fd, buf + 1, buf_size - 1)) break; } } return NULL; } #define HCI_HANDLE_1 200 #define HCI_HANDLE_2 201 static void initialize_vhci() { int hci_sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); if (hci_sock < 0) exit(1); vhci_fd = open("/dev/vhci", O_RDWR); if (vhci_fd == -1) exit(1); const int kVhciFd = 241; if (dup2(vhci_fd, kVhciFd) < 0) exit(1); close(vhci_fd); vhci_fd = kVhciFd; struct vhci_vendor_pkt vendor_pkt; if (read(vhci_fd, &vendor_pkt, sizeof(vendor_pkt)) != sizeof(vendor_pkt)) exit(1); if (vendor_pkt.type != HCI_VENDOR_PKT) exit(1); pthread_t th; if (pthread_create(&th, NULL, event_thread, NULL)) exit(1); int ret = ioctl(hci_sock, HCIDEVUP, vendor_pkt.id); if (ret) { if (errno == ERFKILL) { rfkill_unblock_all(); ret = ioctl(hci_sock, HCIDEVUP, vendor_pkt.id); } if (ret && errno != EALREADY) exit(1); } struct hci_dev_req dr = {0}; dr.dev_id = vendor_pkt.id; dr.dev_opt = SCAN_PAGE; if (ioctl(hci_sock, HCISETSCAN, &dr)) exit(1); struct hci_ev_conn_request request; memset(&request, 0, sizeof(request)); memset(&request.bdaddr, 0xaa, 6); *(uint8_t*)&request.bdaddr.b[5] = 0x10; request.link_type = ACL_LINK; hci_send_event_packet(vhci_fd, HCI_EV_CONN_REQUEST, &request, sizeof(request)); struct hci_ev_conn_complete complete; memset(&complete, 0, sizeof(complete)); complete.status = 0; complete.handle = HCI_HANDLE_1; memset(&complete.bdaddr, 0xaa, 6); *(uint8_t*)&complete.bdaddr.b[5] = 0x10; complete.link_type = ACL_LINK; complete.encr_mode = 0; hci_send_event_packet(vhci_fd, HCI_EV_CONN_COMPLETE, &complete, sizeof(complete)); struct hci_ev_remote_features features; memset(&features, 0, sizeof(features)); features.status = 0; features.handle = HCI_HANDLE_1; hci_send_event_packet(vhci_fd, HCI_EV_REMOTE_FEATURES, &features, sizeof(features)); struct { struct hci_ev_le_meta le_meta; struct hci_ev_le_conn_complete le_conn; } le_conn; memset(&le_conn, 0, sizeof(le_conn)); le_conn.le_meta.subevent = HCI_EV_LE_CONN_COMPLETE; memset(&le_conn.le_conn.bdaddr, 0xaa, 6); *(uint8_t*)&le_conn.le_conn.bdaddr.b[5] = 0x11; le_conn.le_conn.role = 1; le_conn.le_conn.handle = HCI_HANDLE_2; hci_send_event_packet(vhci_fd, HCI_EV_LE_META, &le_conn, sizeof(le_conn)); pthread_join(th, NULL); close(hci_sock); } #define XT_TABLE_SIZE 1536 #define XT_MAX_ENTRIES 10 struct xt_counters { uint64_t pcnt, bcnt; }; struct ipt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_entries; unsigned int size; }; struct ipt_get_entries { char name[32]; unsigned int size; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct ipt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[5]; unsigned int underflow[5]; unsigned int num_counters; struct xt_counters* counters; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct ipt_table_desc { const char* name; struct ipt_getinfo info; struct ipt_replace replace; }; static struct ipt_table_desc ipv4_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; static struct ipt_table_desc ipv6_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, {.name = "raw"}, {.name = "security"}, }; #define IPT_BASE_CTL 64 #define IPT_SO_SET_REPLACE (IPT_BASE_CTL) #define IPT_SO_GET_INFO (IPT_BASE_CTL) #define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) struct arpt_getinfo { char name[32]; unsigned int valid_hooks; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_entries; unsigned int size; }; struct arpt_get_entries { char name[32]; unsigned int size; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct arpt_replace { char name[32]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[3]; unsigned int underflow[3]; unsigned int num_counters; struct xt_counters* counters; uint64_t entrytable[XT_TABLE_SIZE / sizeof(uint64_t)]; }; struct arpt_table_desc { const char* name; struct arpt_getinfo info; struct arpt_replace replace; }; static struct arpt_table_desc arpt_tables[] = { {.name = "filter"}, }; #define ARPT_BASE_CTL 96 #define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) #define ARPT_SO_GET_INFO (ARPT_BASE_CTL) #define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) static void checkpoint_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { int fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (int i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); struct ipt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_iptables(struct ipt_table_desc* tables, int num_tables, int family, int level) { int fd = socket(family, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (int i = 0; i < num_tables; i++) { struct ipt_table_desc* table = &tables[i]; if (table->info.valid_hooks == 0) continue; struct ipt_getinfo info; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); socklen_t optlen = sizeof(info); if (getsockopt(fd, level, IPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { struct ipt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } struct xt_counters counters[XT_MAX_ENTRIES]; table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, level, IPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_arptables(void) { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (unsigned i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; strcpy(table->info.name, table->name); strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &table->info, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->info.size > sizeof(table->replace.entrytable)) exit(1); if (table->info.num_entries > XT_MAX_ENTRIES) exit(1); struct arpt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); table->replace.valid_hooks = table->info.valid_hooks; table->replace.num_entries = table->info.num_entries; table->replace.size = table->info.size; memcpy(table->replace.hook_entry, table->info.hook_entry, sizeof(table->replace.hook_entry)); memcpy(table->replace.underflow, table->info.underflow, sizeof(table->replace.underflow)); memcpy(table->replace.entrytable, entries.entrytable, table->info.size); } close(fd); } static void reset_arptables() { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (unsigned i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { struct arpt_table_desc* table = &arpt_tables[i]; if (table->info.valid_hooks == 0) continue; struct arpt_getinfo info; memset(&info, 0, sizeof(info)); strcpy(info.name, table->name); socklen_t optlen = sizeof(info); if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &info, &optlen)) exit(1); if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { struct arpt_get_entries entries; memset(&entries, 0, sizeof(entries)); strcpy(entries.name, table->name); entries.size = table->info.size; optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) exit(1); if (memcmp(table->replace.entrytable, entries.entrytable, table->info.size) == 0) continue; } else { } struct xt_counters counters[XT_MAX_ENTRIES]; table->replace.num_counters = info.num_entries; table->replace.counters = counters; optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + table->replace.size; if (setsockopt(fd, SOL_IP, ARPT_SO_SET_REPLACE, &table->replace, optlen)) exit(1); } close(fd); } #define NF_BR_NUMHOOKS 6 #define EBT_TABLE_MAXNAMELEN 32 #define EBT_CHAIN_MAXNAMELEN 32 #define EBT_BASE_CTL 128 #define EBT_SO_SET_ENTRIES (EBT_BASE_CTL) #define EBT_SO_GET_INFO (EBT_BASE_CTL) #define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO + 1) #define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES + 1) #define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO + 1) struct ebt_replace { char name[EBT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int nentries; unsigned int entries_size; struct ebt_entries* hook_entry[NF_BR_NUMHOOKS]; unsigned int num_counters; struct ebt_counter* counters; char* entries; }; struct ebt_entries { unsigned int distinguisher; char name[EBT_CHAIN_MAXNAMELEN]; unsigned int counter_offset; int policy; unsigned int nentries; char data[0] __attribute__((aligned(__alignof__(struct ebt_replace)))); }; struct ebt_table_desc { const char* name; struct ebt_replace replace; char entrytable[XT_TABLE_SIZE]; }; static struct ebt_table_desc ebt_tables[] = { {.name = "filter"}, {.name = "nat"}, {.name = "broute"}, }; static void checkpoint_ebtables(void) { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (size_t i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; strcpy(table->replace.name, table->name); socklen_t optlen = sizeof(table->replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_INFO, &table->replace, &optlen)) { switch (errno) { case EPERM: case ENOENT: case ENOPROTOOPT: continue; } exit(1); } if (table->replace.entries_size > sizeof(table->entrytable)) exit(1); table->replace.num_counters = 0; table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_ENTRIES, &table->replace, &optlen)) exit(1); } close(fd); } static void reset_ebtables() { int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd == -1) { switch (errno) { case EAFNOSUPPORT: case ENOPROTOOPT: return; } exit(1); } for (unsigned i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { struct ebt_table_desc* table = &ebt_tables[i]; if (table->replace.valid_hooks == 0) continue; struct ebt_replace replace; memset(&replace, 0, sizeof(replace)); strcpy(replace.name, table->name); socklen_t optlen = sizeof(replace); if (getsockopt(fd, SOL_IP, EBT_SO_GET_INFO, &replace, &optlen)) exit(1); replace.num_counters = 0; table->replace.entries = 0; for (unsigned h = 0; h < NF_BR_NUMHOOKS; h++) table->replace.hook_entry[h] = 0; if (memcmp(&table->replace, &replace, sizeof(table->replace)) == 0) { char entrytable[XT_TABLE_SIZE]; memset(&entrytable, 0, sizeof(entrytable)); replace.entries = entrytable; optlen = sizeof(replace) + replace.entries_size; if (getsockopt(fd, SOL_IP, EBT_SO_GET_ENTRIES, &replace, &optlen)) exit(1); if (memcmp(table->entrytable, entrytable, replace.entries_size) == 0) continue; } for (unsigned j = 0, h = 0; h < NF_BR_NUMHOOKS; h++) { if (table->replace.valid_hooks & (1 << h)) { table->replace.hook_entry[h] = (struct ebt_entries*)table->entrytable + j; j++; } } table->replace.entries = table->entrytable; optlen = sizeof(table->replace) + table->replace.entries_size; if (setsockopt(fd, SOL_IP, EBT_SO_SET_ENTRIES, &table->replace, optlen)) exit(1); } close(fd); } static void checkpoint_net_namespace(void) { checkpoint_ebtables(); checkpoint_arptables(); checkpoint_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); checkpoint_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void reset_net_namespace(void) { reset_ebtables(); reset_arptables(); reset_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), AF_INET, SOL_IP); reset_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), AF_INET6, SOL_IPV6); } static void setup_common() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } static void loop(); static void sandbox_common() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setsid(); struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = (200 << 20); setrlimit(RLIMIT_AS, &rlim); rlim.rlim_cur = rlim.rlim_max = 32 << 20; setrlimit(RLIMIT_MEMLOCK, &rlim); rlim.rlim_cur = rlim.rlim_max = 136 << 20; setrlimit(RLIMIT_FSIZE, &rlim); rlim.rlim_cur = rlim.rlim_max = 1 << 20; setrlimit(RLIMIT_STACK, &rlim); rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); rlim.rlim_cur = rlim.rlim_max = 256; setrlimit(RLIMIT_NOFILE, &rlim); if (unshare(CLONE_NEWNS)) { } if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) { } if (unshare(CLONE_NEWIPC)) { } if (unshare(0x02000000)) { } if (unshare(CLONE_NEWUTS)) { } if (unshare(CLONE_SYSVSEM)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } static int wait_for_loop(int pid) { if (pid < 0) exit(1); int status = 0; while (waitpid(-1, &status, __WALL) != pid) { } return WEXITSTATUS(status); } static void drop_caps(void) { struct __user_cap_header_struct cap_hdr = {}; struct __user_cap_data_struct cap_data[2] = {}; cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; cap_hdr.pid = getpid(); if (syscall(SYS_capget, &cap_hdr, &cap_data)) exit(1); const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE); cap_data[0].effective &= ~drop; cap_data[0].permitted &= ~drop; cap_data[0].inheritable &= ~drop; if (syscall(SYS_capset, &cap_hdr, &cap_data)) exit(1); } static int do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); setup_common(); initialize_vhci(); sandbox_common(); drop_caps(); initialize_netdevices_init(); if (unshare(CLONE_NEWNET)) { } initialize_tun(); initialize_netdevices(); initialize_wifi_devices(); loop(); exit(1); } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_loop() { checkpoint_net_namespace(); } static void reset_loop() { reset_net_namespace(); } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); flush_tun(); } static void close_fds() { for (int fd = 3; fd < MAX_FDS; fd++) close(fd); } static void setup_binfmt_misc() { if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0)) { } write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:\x01::./file0:"); write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:\x02::./file0:POC"); } static void setup_usb() { if (chmod("/dev/raw-gadget", 0666)) exit(1); } struct thread_t { int created, call; event_t ready, done; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { event_wait(&th->ready); event_reset(&th->ready); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); event_set(&th->done); } return 0; } static void execute_one(void) { int i, call, thread; int collide = 0; again: for (call = 0; call < 2; call++) { for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; event_init(&th->ready); event_init(&th->done); event_set(&th->done); thread_start(thr, th); } if (!event_isset(&th->done)) continue; event_reset(&th->done); th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); event_set(&th->ready); if (collide && (call % 2) == 0) break; event_timedwait(&th->done, 45); break; } } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); close_fds(); if (!collide) { collide = 1; goto again; } } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { setup_loop(); int iter = 0; for (;; iter++) { reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5 * 1000) continue; kill_and_wait(pid, &status); break; } } } void execute_call(int call) { switch (call) { case 0: NONFAILING(syz_usbip_server_init(5)); break; case 1: NONFAILING(syz_usbip_server_init(5)); break; } } int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); setup_binfmt_misc(); setup_usb(); install_segv_handler(); for (procid = 0; procid < 6; procid++) { if (fork() == 0) { do_sandbox_none(); } } sleep(1000000); return 0; }
the_stack_data/95780.c
/* * PackCC: a packrat parser generator for C. * * Copyright (c) 2014 Arihiro Yoshida. All rights reserved. * Copyright (c) 2017 Arvid Gerstmann. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* * The algorithm is based on the paper "Packrat Parsers Can Support Left Recursion" * authored by A. Warth, J. R. Douglass, and T. Millstein. * * The specification is determined by referring to peg/leg developed by Ian Piumarta. */ #ifdef _MSC_VER #undef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #ifdef _DEBUG #define _CRTDBG_MAP_ALLOC #include <crtdbg.h> #endif #endif #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <assert.h> #ifndef _MSC_VER #if defined __GNUC__ && defined _WIN32 /* MinGW */ static size_t strnlen(const char *str, size_t maxlen) { size_t i; for (i = 0; str[i] && i < maxlen; i++); return i; } #else #include <unistd.h> /* for strnlen() */ #endif #endif #ifdef _MSC_VER #undef snprintf #undef unlink #define snprintf _snprintf #define unlink _unlink #endif #define VERSION "1.2.0" #ifndef BUFFER_INIT_SIZE #define BUFFER_INIT_SIZE 256 #endif #ifndef ARRAY_INIT_SIZE #define ARRAY_INIT_SIZE 2 #endif typedef enum bool_tag { FALSE = 0, TRUE } bool_t; typedef struct char_array_tag { char *buf; int max; int len; } char_array_t; typedef enum node_type_tag { NODE_RULE = 0, NODE_REFERENCE, NODE_STRING, NODE_CHARCLASS, NODE_QUANTITY, NODE_PREDICATE, NODE_SEQUENCE, NODE_ALTERNATE, NODE_CAPTURE, NODE_EXPAND, NODE_ACTION, NODE_TEST, NODE_ERROR, } node_type_t; typedef struct node_tag node_t; typedef struct node_array_tag { node_t **buf; int max; int len; } node_array_t; typedef struct node_const_array_tag { const node_t **buf; int max; int len; } node_const_array_t; typedef struct node_hash_table_tag { const node_t **buf; int max; int mod; } node_hash_table_t; typedef struct node_rule_tag { char *name; node_t *expr; int ref; /* mutable */ node_const_array_t vars; node_const_array_t capts; node_const_array_t codes; int line; int col; } node_rule_t; typedef struct node_reference_tag { char *var; /* NULL if no variable name */ int index; char *name; const node_t *rule; int line; int col; } node_reference_t; typedef struct node_string_tag { char *value; } node_string_t; typedef struct node_charclass_tag { char *value; /* NULL means any character */ } node_charclass_t; typedef struct node_quantity_tag { int min; int max; node_t *expr; } node_quantity_t; typedef struct node_predicate_tag { bool_t neg; node_t *expr; } node_predicate_t; typedef struct node_sequence_tag { node_array_t nodes; } node_sequence_t; typedef struct node_alternate_tag { node_array_t nodes; } node_alternate_t; typedef struct node_capture_tag { node_t *expr; int index; } node_capture_t; typedef struct node_expand_tag { int index; int line; int col; } node_expand_t; typedef struct node_action_tag { char *value; int index; node_const_array_t vars; node_const_array_t capts; } node_action_t; typedef struct node_error_tag { node_t *expr; char *value; int index; node_const_array_t vars; node_const_array_t capts; } node_error_t; typedef struct node_test_tag { node_t *expr; char *value; int index; node_const_array_t vars; node_const_array_t capts; } node_test_t; typedef union node_data_tag { node_rule_t rule; node_reference_t reference; node_string_t string; node_charclass_t charclass; node_quantity_t quantity; node_predicate_t predicate; node_sequence_t sequence; node_alternate_t alternate; node_capture_t capture; node_expand_t expand; node_action_t action; node_test_t test; node_error_t error; } node_data_t; struct node_tag { node_type_t type; node_data_t data; }; typedef struct context_tag { char *iname; char *sname; char *hname; FILE *ifile; FILE *sfile; FILE *hfile; char *hid; char *vtype; char *atype; char *prefix; bool_t debug; int errnum; int linenum; int linepos; int bufpos; char_array_t buffer; node_array_t rules; node_hash_table_t rulehash; } context_t; typedef struct generate_tag { FILE *stream; const node_t *rule; int label; } generate_t; typedef enum string_flag_tag { STRING_FLAG__NONE = 0, STRING_FLAG__NOTEMPTY = 1, STRING_FLAG__NOTVOID = 2, STRING_FLAG__IDENTIFIER = 4, } string_flag_t; typedef enum code_reach_tag { CODE_REACH__BOTH = 0, CODE_REACH__ALWAYS_SUCCEED = 1, CODE_REACH__ALWAYS_FAIL = -1 } code_reach_t; static const char *g_cmdname = "packcc"; /* replaced later with actual one */ static int print_error(const char *format, ...) { int n; va_list a; va_start(a, format); n = fprintf(stderr, "%s: ", g_cmdname) + vfprintf(stderr, format, a); va_end(a); return n; } static FILE *fopen_rb_e(const char *path) { FILE *f = fopen(path, "rb"); if (f == NULL) { print_error("Cannot open file '%s' to read\n", path); exit(2); } return f; } static FILE *fopen_wt_e(const char *path) { FILE *f = fopen(path, "wt"); if (f == NULL) { print_error("Cannot open file '%s' to write\n", path); exit(2); } return f; } static void *malloc_e(int size) { void *p = malloc((size_t)size); if (p == NULL) { print_error("Out of memory\n"); exit(3); } return p; } static void *realloc_e(void *ptr, int size) { void *p = realloc(ptr, (size_t)size); if (p == NULL) { print_error("Out of memory\n"); exit(3); } return p; } static char *strdup_e(const char *str) { int m = (int)strlen(str); char *s = (char *)malloc_e(m + 1); memcpy(s, str, (size_t)m); s[m] = '\0'; return s; } static char *strndup_e(const char *str, int len) { int m = (int)strnlen(str, (size_t)len); char *s = (char *)malloc_e(m + 1); memcpy(s, str, (size_t)m); s[m] = '\0'; return s; } static bool_t is_filled_string(const char *str) { size_t i; for (i = 0; str[i]; i++) { if ( str[i] != ' ' && str[i] != '\v' && str[i] != '\f' && str[i] != '\t' && str[i] != '\n' && str[i] != '\r' ) return TRUE; } return FALSE; } static bool_t is_identifier_string(const char *str) { size_t i; if (!( (str[0] >= 'a' && str[0] <= 'z') || (str[0] >= 'A' && str[0] <= 'Z') || str[0] == '_' )) return FALSE; for (i = 1; str[i]; i++) { if (!( (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= '0' && str[i] <= '9') || str[i] == '_' )) return FALSE; } return TRUE; } static bool_t is_pointer_type(const char *str) { size_t n = strlen(str); return (n > 0 && str[n - 1] == '*') ? TRUE : FALSE; } static bool_t unescape_string(char *str) { bool_t b = TRUE; size_t i, j; for (j = 0, i = 0; str[i]; i++) { if (str[i] == '\\') { i++; switch (str[i]) { case '\0': str[j++] = '\\'; str[j] = '\0'; return FALSE; case '0': str[j++] = '\x00'; break; case 'a': str[j++] = '\x07'; break; case 'b': str[j++] = '\x08'; break; case 'f': str[j++] = '\x0c'; break; case 'n': str[j++] = '\x0a'; break; case 'r': str[j++] = '\x0d'; break; case 't': str[j++] = '\x09'; break; case 'v': str[j++] = '\x0b'; break; case 'x': if (str[i + 1] == '\0') { str[j++] = '\\'; str[j++] = 'x'; str[j] = '\0'; return FALSE; } if (str[i + 2] == '\0') { str[j++] = '\\'; str[j++] = 'x'; str[j++] = str[i + 1]; str[j] = '\0'; return FALSE; } { char c = str[i + 1]; char d = str[i + 2]; c = (c >= '0' && c <= '9') ? c - '0' : (c >= 'a' && c <= 'f') ? c - 'a' + 10 : (c >= 'A' && c <= 'F') ? c - 'A' + 10 : -1; d = (d >= '0' && d <= '9') ? d - '0' : (d >= 'a' && d <= 'f') ? d - 'a' + 10 : (d >= 'A' && d <= 'F') ? d - 'A' + 10 : -1; if (c < 0 || d < 0) { str[j++] = '\\'; str[j++] = 'x'; str[j++] = str[i + 1]; str[j++] = str[i + 2]; b = FALSE; } else { str[j++] = (char)((c << 4) | d); } i += 2; } break; case '\n': break; case '\r': if (str[i + 1] == '\n') i++; break; default: str[j++] = str[i]; } } else { str[j++] = str[i]; } } str[j] = '\0'; return b; } static const char *escape_character(char ch, char (*buf)[5]) { switch (ch) { case '\x00': strncpy(*buf, "\\0", 5); break; case '\x07': strncpy(*buf, "\\a", 5); break; case '\x08': strncpy(*buf, "\\b", 5); break; case '\x0c': strncpy(*buf, "\\f", 5); break; case '\x0a': strncpy(*buf, "\\n", 5); break; case '\x0d': strncpy(*buf, "\\r", 5); break; case '\x09': strncpy(*buf, "\\t", 5); break; case '\x0b': strncpy(*buf, "\\v", 5); break; case '\\': strncpy(*buf, "\\\\", 5); break; case '\'': strncpy(*buf, "\\\'", 5); break; case '\"': strncpy(*buf, "\\\"", 5); break; default: if (ch >= '\x20' && ch < '\x7f') snprintf(*buf, 5, "%c", ch); else snprintf(*buf, 5, "\\x%02x", (unsigned)ch); } (*buf)[4] = '\0'; return *buf; } static void remove_heading_blank(char *str) { size_t i, j; for (i = 0; str[i]; i++) { if ( str[i] != ' ' && str[i] != '\v' && str[i] != '\f' && str[i] != '\t' && str[i] != '\n' && str[i] != '\r' ) break; } for (j = 0; str[i]; i++) { str[j++] = str[i]; } str[j] = '\0'; } static void remove_trailing_blank(char *str) { size_t i, j; for (j = 0, i = 0; str[i]; i++) { if ( str[i] != ' ' && str[i] != '\v' && str[i] != '\f' && str[i] != '\t' && str[i] != '\n' && str[i] != '\r' ) j = i + 1; } str[j] = '\0'; } static void make_header_identifier(char *str) { size_t i; for (i = 0; str[i]; i++) { str[i] = ((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= '0' && str[i] <= '9')) ? str[i] : (str[i] >= 'a' && str[i] <= 'z') ? str[i] - 'a' + 'A' : '_'; } } static void write_characters(FILE *stream, char ch, int len) { int i; for (i = 0; i < len; i++) fputc(ch, stream); } static void write_text(FILE *stream, const char *ptr, int len) { int i; for (i = 0; i < len; i++) { if (ptr[i] == '\r') { if (i + 1 < len && ptr[i + 1] == '\n') i++; fputc('\n', stream); } else { fputc(ptr[i], stream); } } } static void write_code_block(FILE *stream, const char *ptr, int len, int indent) { int i; for (i = 0; i < len; i++) { if (ptr[i] == '\n') break; if (ptr[i] == '\r') { if (i + 1 < len && ptr[i + 1] == '\n') i++; break; } } if (i < len) { bool_t s = TRUE; int k = i + 1; int l = 0, m = -1; for (i = k; i < len; i++) { switch (ptr[i]) { case ' ': case '\v': case '\f': if (s) l++; break; case '\t': if (s) l = (l + 8) & ~7; break; case '\n': s = TRUE; l = 0; break; case '\r': if (i + 1 < len && ptr[i + 1] == '\n') i++; s = TRUE; l = 0; break; default: s = FALSE; m = (m >= 0 && m < l) ? m : l; } } for (i = 0; i < k; i++) { if ( ptr[i] != ' ' && ptr[i] != '\v' && ptr[i] != '\f' && ptr[i] != '\t' && ptr[i] != '\n' && ptr[i] != '\r' ) break; } if (i < k) { write_characters(stream, ' ', indent); write_text(stream, ptr + i, k - i); } s = TRUE; l = 0; for (i = k; i < len; i++) { switch (ptr[i]) { case ' ': case '\v': case '\f': if (s) l++; else fputc(ptr[i], stream); break; case '\t': if (s) l = (l + 8) & ~7; else fputc(ptr[i], stream); break; case '\n': fputc('\n', stream); s = TRUE; l = 0; break; case '\r': if (i + 1 < len && ptr[i + 1] == '\n') i++; fputc('\n', stream); s = TRUE; l = 0; break; default: if (s) { write_characters(stream, ' ', l - m + indent); s = FALSE; } fputc(ptr[i], stream); } } if (!s) fputc('\n', stream); } else { for (i = 0; i < len; i++) { if ( ptr[i] != ' ' && ptr[i] != '\v' && ptr[i] != '\f' && ptr[i] != '\t' ) break; } if (i < len) { write_characters(stream, ' ', indent); write_text(stream, ptr + i, (int)(len - i)); fputc('\n', stream); } } } static const char *extract_filename(const char *path) { int i, n = (int)strlen(path); for (i = n - 1; i >= 0; i--) { if (path[i] == '/' || path[i] == '\\' || path[i] == ':') break; } return path + i + 1; } static const char *extract_fileext(const char *path) { int i, n = (int)strlen(path); for (i = n - 1; i >= 0; i--) { if (path[i] == '/' || path[i] == '\\' || path[i] == ':') break; if (path[i] == '.') return path + i; } return path + n; } static char *replace_fileext(const char *path, const char *ext) { const char *p = extract_fileext(path); int m = (int)(p - path); int n = (int)strlen(ext); char *s = (char *)malloc_e(m + n + 2); memcpy(s, path, (size_t)m); s[m] = '.'; memcpy(s + m + 1, ext, (size_t)(n + 1)); return s; } static char *add_fileext(const char *path, const char *ext) { int m = (int)strlen(path); int n = (int)strlen(ext); char *s = (char *)malloc_e(m + n + 2); memcpy(s, path, (size_t)m); s[m] = '.'; memcpy(s + m + 1, ext, (size_t)(n + 1)); return s; } static int hash_string(const char *str) { int i, h = 0; for (i = 0; str[i]; i++) { h = h * 31 + str[i]; } return h; } static int populate_bits(int x) { x |= x >> 1; x |= x >> 2; x |= x >> 4; x |= x >> 8; x |= x >> 16; return x; } static void char_array__init(char_array_t *array, int max) { array->len = 0; array->max = max; array->buf = (char *)malloc_e(array->max); } static void char_array__add(char_array_t *array, char ch) { if (array->max <= 0) array->max = 1; while (array->max <= array->len) array->max <<= 1; array->buf = (char *)realloc_e(array->buf, array->max); array->buf[array->len++] = ch; } static void char_array__term(char_array_t *array) { free(array->buf); } static void node_array__init(node_array_t *array, int max) { array->len = 0; array->max = max; array->buf = (node_t **)malloc_e(array->max * (int)sizeof(node_t *)); } static void node_array__add(node_array_t *array, node_t *node) { if (array->max <= 0) array->max = 1; while (array->max <= array->len) array->max <<= 1; array->buf = (node_t **)realloc_e(array->buf, array->max * (int)sizeof(node_t *)); array->buf[array->len++] = node; } static void destroy_node(node_t *node); static void node_array__term(node_array_t *array) { int i; for (i = array->len - 1; i >= 0; i--) { destroy_node(array->buf[i]); } free(array->buf); } static void node_const_array__init(node_const_array_t *array, int max) { array->len = 0; array->max = max; array->buf = (const node_t **)malloc_e(array->max * (int)sizeof(const node_t *)); } static void node_const_array__add(node_const_array_t *array, const node_t *node) { if (array->max <= 0) array->max = 1; while (array->max <= array->len) array->max <<= 1; array->buf = (const node_t **)realloc_e((node_t **)array->buf, array->max * (int)sizeof(const node_t *)); array->buf[array->len++] = node; } static void node_const_array__clear(node_const_array_t *array) { array->len = 0; } static void node_const_array__copy(node_const_array_t *array, const node_const_array_t *src) { int i; node_const_array__clear(array); for (i = 0; i < src->len; i++) { node_const_array__add(array, src->buf[i]); } } static void node_const_array__term(node_const_array_t *array) { free((node_t **)array->buf); } static context_t *create_context(const char *iname, const char *oname, bool_t debug) { context_t *ctx = (context_t *)malloc_e((int)sizeof(context_t)); ctx->iname = strdup_e((iname && iname[0]) ? iname : "-"); ctx->sname = (oname && oname[0]) ? add_fileext(oname, "c") : replace_fileext(ctx->iname, "c"); ctx->hname = (oname && oname[0]) ? add_fileext(oname, "h") : replace_fileext(ctx->iname, "h"); ctx->ifile = (iname && iname[0]) ? fopen_rb_e(ctx->iname) : stdin; ctx->sfile = fopen_wt_e(ctx->sname); ctx->hfile = fopen_wt_e(ctx->hname); ctx->hid = strdup_e(ctx->hname); make_header_identifier(ctx->hid); ctx->vtype = NULL; ctx->atype = NULL; ctx->prefix = NULL; ctx->debug = debug; ctx->errnum = 0; ctx->linenum = 0; ctx->linepos = 0; ctx->bufpos = 0; char_array__init(&ctx->buffer, BUFFER_INIT_SIZE); node_array__init(&ctx->rules, ARRAY_INIT_SIZE); ctx->rulehash.mod = 0; ctx->rulehash.max = 0; ctx->rulehash.buf = NULL; return ctx; } static node_t *create_node(node_type_t type) { node_t *node = (node_t *)malloc_e((int)sizeof(node_t)); node->type = type; switch (node->type) { case NODE_RULE: node->data.rule.name = NULL; node->data.rule.expr = NULL; node->data.rule.ref = 0; node_const_array__init(&node->data.rule.vars, ARRAY_INIT_SIZE); node_const_array__init(&node->data.rule.capts, ARRAY_INIT_SIZE); node_const_array__init(&node->data.rule.codes, ARRAY_INIT_SIZE); node->data.rule.line = -1; node->data.rule.col = -1; break; case NODE_REFERENCE: node->data.reference.var = NULL; node->data.reference.index = -1; node->data.reference.name = NULL; node->data.reference.rule = NULL; node->data.reference.line = -1; node->data.reference.col = -1; break; case NODE_STRING: node->data.string.value = NULL; break; case NODE_CHARCLASS: node->data.charclass.value = NULL; break; case NODE_QUANTITY: node->data.quantity.min = node->data.quantity.max = 0; node->data.quantity.expr = NULL; break; case NODE_PREDICATE: node->data.predicate.neg = FALSE; node->data.predicate.expr = NULL; break; case NODE_SEQUENCE: node_array__init(&node->data.sequence.nodes, ARRAY_INIT_SIZE); break; case NODE_ALTERNATE: node_array__init(&node->data.alternate.nodes, ARRAY_INIT_SIZE); break; case NODE_CAPTURE: node->data.capture.expr = NULL; node->data.capture.index = -1; break; case NODE_EXPAND: node->data.expand.index = -1; node->data.expand.line = -1; node->data.expand.col = -1; break; case NODE_ACTION: node->data.action.value = NULL; node->data.action.index = -1; node_const_array__init(&node->data.action.vars, ARRAY_INIT_SIZE); node_const_array__init(&node->data.action.capts, ARRAY_INIT_SIZE); break; case NODE_TEST: node->data.test.expr = NULL; node->data.test.value = NULL; node->data.test.index = -1; node_const_array__init(&node->data.test.vars, ARRAY_INIT_SIZE); node_const_array__init(&node->data.test.capts, ARRAY_INIT_SIZE); break; case NODE_ERROR: node->data.error.expr = NULL; node->data.error.value = NULL; node->data.error.index = -1; node_const_array__init(&node->data.error.vars, ARRAY_INIT_SIZE); node_const_array__init(&node->data.error.capts, ARRAY_INIT_SIZE); break; default: print_error("Internal error [%d]\n", __LINE__); exit(-1); } return node; } static void destroy_node(node_t *node) { if (node == NULL) return; switch (node->type) { case NODE_RULE: node_const_array__term(&node->data.rule.codes); node_const_array__term(&node->data.rule.capts); node_const_array__term(&node->data.rule.vars); destroy_node(node->data.rule.expr); free(node->data.rule.name); break; case NODE_REFERENCE: free(node->data.reference.name); free(node->data.reference.var); break; case NODE_STRING: free(node->data.string.value); break; case NODE_CHARCLASS: free(node->data.charclass.value); break; case NODE_QUANTITY: destroy_node(node->data.quantity.expr); break; case NODE_PREDICATE: destroy_node(node->data.predicate.expr); break; case NODE_SEQUENCE: node_array__term(&node->data.sequence.nodes); break; case NODE_ALTERNATE: node_array__term(&node->data.alternate.nodes); break; case NODE_CAPTURE: destroy_node(node->data.capture.expr); break; case NODE_EXPAND: break; case NODE_ACTION: node_const_array__term(&node->data.action.capts); node_const_array__term(&node->data.action.vars); free(node->data.action.value); break; case NODE_TEST: node_const_array__term(&node->data.test.capts); node_const_array__term(&node->data.test.vars); free(node->data.test.value); destroy_node(node->data.test.expr); break; case NODE_ERROR: node_const_array__term(&node->data.error.capts); node_const_array__term(&node->data.error.vars); free(node->data.error.value); destroy_node(node->data.error.expr); break; default: print_error("Internal error [%d]\n", __LINE__); exit(-1); } free(node); } static void destroy_context(context_t *ctx) { if (ctx == NULL) return; free((node_t **)ctx->rulehash.buf); node_array__term(&ctx->rules); char_array__term(&ctx->buffer); free(ctx->prefix); free(ctx->atype); free(ctx->vtype); free(ctx->hid); fclose(ctx->hfile); if (ctx->errnum) unlink(ctx->hname); fclose(ctx->sfile); if (ctx->errnum) unlink(ctx->sname); fclose(ctx->ifile); free(ctx->hname); free(ctx->sname); free(ctx->iname); free(ctx); } static void make_rulehash(context_t *ctx) { int i, j; ctx->rulehash.mod = populate_bits(ctx->rules.len * 4); ctx->rulehash.max = ctx->rulehash.mod + 1; ctx->rulehash.buf = (const node_t **)realloc_e((node_t **)ctx->rulehash.buf, ctx->rulehash.max * (int)sizeof(const node_t *)); for (i = 0; i < ctx->rulehash.max; i++) { ctx->rulehash.buf[i] = NULL; } for (i = 0; i < ctx->rules.len; i++) { assert(ctx->rules.buf[i]->type == NODE_RULE); j = hash_string(ctx->rules.buf[i]->data.rule.name) & ctx->rulehash.mod; while (ctx->rulehash.buf[j] != NULL) { if (strcmp(ctx->rules.buf[i]->data.rule.name, ctx->rulehash.buf[j]->data.rule.name) == 0) { assert(ctx->rules.buf[i]->data.rule.ref == 0); assert(ctx->rulehash.buf[j]->data.rule.ref == 0); ctx->rules.buf[i]->data.rule.ref = -1; goto EXCEPTION; } j = (j + 1) & ctx->rulehash.mod; } ctx->rulehash.buf[j] = ctx->rules.buf[i]; EXCEPTION:; } } static const node_t *lookup_rulehash(const context_t *ctx, const char *name) { int j = hash_string(name) & ctx->rulehash.mod; while (ctx->rulehash.buf[j] != NULL && strcmp(name, ctx->rulehash.buf[j]->data.rule.name) != 0) { j = (j + 1) & ctx->rulehash.mod; } return (ctx->rulehash.buf[j] != NULL) ? ctx->rulehash.buf[j] : NULL; } static void link_references(context_t *ctx, node_t *node) { if (node == NULL) return; switch (node->type) { case NODE_RULE: print_error("Internal error [%d]\n", __LINE__); exit(-1); case NODE_REFERENCE: node->data.reference.rule = lookup_rulehash(ctx, node->data.reference.name); if (node->data.reference.rule == NULL) { print_error("%s:%d:%d: No definition of rule '%s'\n", ctx->iname, node->data.reference.line + 1, node->data.reference.col + 1, node->data.reference.name); ctx->errnum++; } else { assert(node->data.reference.rule->type == NODE_RULE); ((node_t *)node->data.reference.rule)->data.rule.ref++; } break; case NODE_STRING: break; case NODE_CHARCLASS: break; case NODE_QUANTITY: link_references(ctx, node->data.quantity.expr); break; case NODE_PREDICATE: link_references(ctx, node->data.predicate.expr); break; case NODE_SEQUENCE: { int i; for (i = 0; i < node->data.sequence.nodes.len; i++) { link_references(ctx, node->data.sequence.nodes.buf[i]); } } break; case NODE_ALTERNATE: { int i; for (i = 0; i < node->data.alternate.nodes.len; i++) { link_references(ctx, node->data.alternate.nodes.buf[i]); } } break; case NODE_CAPTURE: link_references(ctx, node->data.capture.expr); break; case NODE_EXPAND: break; case NODE_ACTION: break; case NODE_TEST: link_references(ctx, node->data.test.expr); break; case NODE_ERROR: link_references(ctx, node->data.error.expr); break; default: print_error("Internal error [%d]\n", __LINE__); exit(-1); } } static void verify_variables(context_t *ctx, node_t *node, node_const_array_t *vars) { node_const_array_t a; bool_t b = (vars == NULL) ? TRUE : FALSE; if (node == NULL) return; if (b) { node_const_array__init(&a, ARRAY_INIT_SIZE); vars = &a; } switch (node->type) { case NODE_RULE: print_error("Internal error [%d]\n", __LINE__); exit(-1); case NODE_REFERENCE: if (node->data.reference.index >= 0) { int i; for (i = 0; i < vars->len; i++) { assert(vars->buf[i]->type == NODE_REFERENCE); if (node->data.reference.index == vars->buf[i]->data.reference.index) break; } if (i == vars->len) node_const_array__add(vars, node); } break; case NODE_STRING: break; case NODE_CHARCLASS: break; case NODE_QUANTITY: verify_variables(ctx, node->data.quantity.expr, vars); break; case NODE_PREDICATE: verify_variables(ctx, node->data.predicate.expr, vars); break; case NODE_SEQUENCE: { int i; for (i = 0; i < node->data.sequence.nodes.len; i++) { verify_variables(ctx, node->data.sequence.nodes.buf[i], vars); } } break; case NODE_ALTERNATE: { int i, j, k, m = vars->len; node_const_array_t v; node_const_array__init(&v, ARRAY_INIT_SIZE); node_const_array__copy(&v, vars); for (i = 0; i < node->data.alternate.nodes.len; i++) { v.len = m; verify_variables(ctx, node->data.alternate.nodes.buf[i], &v); for (j = m; j < v.len; j++) { for (k = m; k < vars->len; k++) { if (v.buf[j]->data.reference.index == vars->buf[k]->data.reference.index) break; } if (k == vars->len) node_const_array__add(vars, v.buf[j]); } } node_const_array__term(&v); } break; case NODE_CAPTURE: verify_variables(ctx, node->data.capture.expr, vars); break; case NODE_EXPAND: break; case NODE_ACTION: node_const_array__copy(&node->data.action.vars, vars); break; case NODE_TEST: node_const_array__copy(&node->data.test.vars, vars); verify_variables(ctx, node->data.test.expr, vars); break; case NODE_ERROR: node_const_array__copy(&node->data.error.vars, vars); verify_variables(ctx, node->data.error.expr, vars); break; default: print_error("Internal error [%d]\n", __LINE__); exit(-1); } if (b) { node_const_array__term(&a); } } static void verify_captures(context_t *ctx, node_t *node, node_const_array_t *capts) { node_const_array_t a; bool_t b = (capts == NULL) ? TRUE : FALSE; if (node == NULL) return; if (b) { node_const_array__init(&a, ARRAY_INIT_SIZE); capts = &a; } switch (node->type) { case NODE_RULE: print_error("Internal error [%d]\n", __LINE__); exit(-1); case NODE_REFERENCE: break; case NODE_STRING: break; case NODE_CHARCLASS: break; case NODE_QUANTITY: verify_captures(ctx, node->data.quantity.expr, capts); break; case NODE_PREDICATE: verify_captures(ctx, node->data.predicate.expr, capts); break; case NODE_SEQUENCE: { int i; for (i = 0; i < node->data.sequence.nodes.len; i++) { verify_captures(ctx, node->data.sequence.nodes.buf[i], capts); } } break; case NODE_ALTERNATE: { int i, j, m = capts->len; node_const_array_t v; node_const_array__init(&v, ARRAY_INIT_SIZE); node_const_array__copy(&v, capts); for (i = 0; i < node->data.alternate.nodes.len; i++) { v.len = m; verify_captures(ctx, node->data.alternate.nodes.buf[i], &v); for (j = m; j < v.len; j++) { node_const_array__add(capts, v.buf[j]); } } node_const_array__term(&v); } break; case NODE_CAPTURE: verify_captures(ctx, node->data.capture.expr, capts); node_const_array__add(capts, node); break; case NODE_EXPAND: { int i; for (i = 0; i < capts->len; i++) { assert(capts->buf[i]->type == NODE_CAPTURE); if (node->data.expand.index == capts->buf[i]->data.capture.index) break; } if (i >= capts->len && node->data.expand.index >= 0) { print_error("%s:%d:%d: Capture %d not available at this position\n", ctx->iname, node->data.expand.line + 1, node->data.expand.col + 1, node->data.expand.index + 1); ctx->errnum++; } } break; case NODE_ACTION: node_const_array__copy(&node->data.action.capts, capts); break; case NODE_TEST: node_const_array__copy(&node->data.test.capts, capts); verify_captures(ctx, node->data.test.expr, capts); break; case NODE_ERROR: node_const_array__copy(&node->data.error.capts, capts); verify_captures(ctx, node->data.error.expr, capts); break; default: print_error("Internal error [%d]\n", __LINE__); exit(-1); } if (b) { node_const_array__term(&a); } } static void dump_node(context_t *ctx, const node_t *node) { if (node == NULL) return; switch (node->type) { case NODE_RULE: fprintf(stdout, "Rule(name:'%s',ref:%d,vars.len:%d,capts.len:%d,codes.len:%d){\n", node->data.rule.name, node->data.rule.ref, node->data.rule.vars.len, node->data.rule.capts.len, node->data.rule.codes.len); dump_node(ctx, node->data.rule.expr); fprintf(stdout, "}\n"); fflush(stdout); break; case NODE_REFERENCE: fprintf(stdout, "Reference(var:'%s',index:%d,name:'%s',rule:'%s')\n", node->data.reference.var, node->data.reference.index, node->data.reference.name, (node->data.reference.rule) ? node->data.reference.rule->data.rule.name : NULL); fflush(stdout); break; case NODE_STRING: fprintf(stdout, "String(value:'%s')\n", node->data.string.value); fflush(stdout); break; case NODE_CHARCLASS: fprintf(stdout, "Charclass(value:'%s')\n", node->data.charclass.value); fflush(stdout); break; case NODE_QUANTITY: fprintf(stdout, "Quantity(min:%d,max%d){\n", node->data.quantity.min, node->data.quantity.max); dump_node(ctx, node->data.quantity.expr); fprintf(stdout, "}\n"); fflush(stdout); break; case NODE_PREDICATE: fprintf(stdout, "Predicate(neg:%d){\n", node->data.predicate.neg); dump_node(ctx, node->data.predicate.expr); fprintf(stdout, "}\n"); fflush(stdout); break; case NODE_SEQUENCE: fprintf(stdout, "Sequence(max:%d,len:%d){\n", node->data.sequence.nodes.max, node->data.sequence.nodes.len); { int i; for (i = 0; i < node->data.sequence.nodes.len; i++) { dump_node(ctx, node->data.sequence.nodes.buf[i]); } } fprintf(stdout, "}\n"); fflush(stdout); break; case NODE_ALTERNATE: fprintf(stdout, "Alternate(max:%d,len:%d){\n", node->data.alternate.nodes.max, node->data.alternate.nodes.len); { int i; for (i = 0; i < node->data.alternate.nodes.len; i++) { dump_node(ctx, node->data.alternate.nodes.buf[i]); } } fprintf(stdout, "}\n"); fflush(stdout); break; case NODE_CAPTURE: fprintf(stdout, "Capture(index:%d){\n", node->data.capture.index); dump_node(ctx, node->data.capture.expr); fprintf(stdout, "}\n"); fflush(stdout); break; case NODE_EXPAND: fprintf(stdout, "Expand(index:%d)\n", node->data.expand.index); fflush(stdout); break; case NODE_ACTION: fprintf(stdout, "Action(index:%d,value:{%s},vars:\n", node->data.action.index, node->data.action.value); { int i; for (i = 0; i < node->data.action.vars.len; i++) { fprintf(stdout, " '%s'\n", node->data.action.vars.buf[i]->data.reference.var); } for (i = 0; i < node->data.action.capts.len; i++) { fprintf(stdout, " $%d\n", node->data.action.capts.buf[i]->data.capture.index + 1); } } fprintf(stdout, ")\n"); fflush(stdout); break; case NODE_TEST: fprintf(stdout, "Test(index:%d,value:{%s},vars:\n", node->data.test.index, node->data.test.value); { int i; for (i = 0; i < node->data.test.vars.len; i++) { fprintf(stdout, " '%s'\n", node->data.test.vars.buf[i]->data.reference.var); } for (i = 0; i < node->data.test.capts.len; i++) { fprintf(stdout, " $%d\n", node->data.test.capts.buf[i]->data.capture.index + 1); } } fprintf(stdout, "){\n"); dump_node(ctx, node->data.test.expr); fprintf(stdout, "}\n"); fflush(stdout); break; break; case NODE_ERROR: fprintf(stdout, "Error(index:%d,value:{%s},vars:\n", node->data.error.index, node->data.error.value); { int i; for (i = 0; i < node->data.error.vars.len; i++) { fprintf(stdout, " '%s'\n", node->data.error.vars.buf[i]->data.reference.var); } for (i = 0; i < node->data.error.capts.len; i++) { fprintf(stdout, " $%d\n", node->data.error.capts.buf[i]->data.capture.index + 1); } } fprintf(stdout, "){\n"); dump_node(ctx, node->data.error.expr); fprintf(stdout, "}\n"); fflush(stdout); break; default: print_error("Internal error [%d]\n", __LINE__); fflush(stdout); exit(-1); } } static int refill_buffer(context_t *ctx, int num) { int n, c; n = ctx->buffer.len - ctx->bufpos; if (n >= num) return n; while (ctx->buffer.len < ctx->bufpos + num) { c = fgetc(ctx->ifile); if (c == EOF) break; char_array__add(&ctx->buffer, (char)c); } return ctx->buffer.len - ctx->bufpos; } static void commit_buffer(context_t *ctx) { ctx->linepos -= ctx->bufpos; memmove(ctx->buffer.buf, ctx->buffer.buf + ctx->bufpos, ctx->buffer.len - ctx->bufpos); ctx->buffer.len -= ctx->bufpos; ctx->bufpos = 0; } static bool_t match_eof(context_t *ctx) { return (refill_buffer(ctx, 1) < 1) ? TRUE : FALSE; } static bool_t match_eol(context_t *ctx) { if (refill_buffer(ctx, 1) >= 1) { switch (ctx->buffer.buf[ctx->bufpos]) { case '\n': ctx->bufpos++; ctx->linenum++; ctx->linepos = ctx->bufpos; return TRUE; case '\r': ctx->bufpos++; if (refill_buffer(ctx, 1) >= 1) { if (ctx->buffer.buf[ctx->bufpos] == '\n') ctx->bufpos++; } ctx->linenum++; ctx->linepos = ctx->bufpos; return TRUE; } } return FALSE; } static bool_t match_character(context_t *ctx, char ch) { if (refill_buffer(ctx, 1) >= 1) { if (ctx->buffer.buf[ctx->bufpos] == ch) { ctx->bufpos++; return TRUE; } } return FALSE; } static bool_t match_character_range(context_t *ctx, char min, char max) { if (refill_buffer(ctx, 1) >= 1) { char c = ctx->buffer.buf[ctx->bufpos]; if (c >= min && c <= max) { ctx->bufpos++; return TRUE; } } return FALSE; } static bool_t match_character_set(context_t *ctx, const char *chs) { if (refill_buffer(ctx, 1) >= 1) { char c = ctx->buffer.buf[ctx->bufpos]; int i; for (i = 0; chs[i]; i++) { if (c == chs[i]) { ctx->bufpos++; return TRUE; } } } return FALSE; } static bool_t match_character_any(context_t *ctx) { if (refill_buffer(ctx, 1) >= 1) { ctx->bufpos++; return TRUE; } return FALSE; } static bool_t match_string(context_t *ctx, const char *str) { int n = (int)strlen(str); if (refill_buffer(ctx, n) >= n) { if (strncmp(ctx->buffer.buf + ctx->bufpos, str, (size_t)n) == 0) { ctx->bufpos += n; return TRUE; } } return FALSE; } static bool_t match_blank(context_t *ctx) { return match_character_set(ctx, " \t\v\f"); } static bool_t match_section_line_(context_t *ctx, const char *head) { if (match_string(ctx, head)) { while (!match_eol(ctx) && !match_eof(ctx)) match_character_any(ctx); return TRUE; } return FALSE; } static bool_t match_section_line_continuable_(context_t *ctx, const char *head) { if (match_string(ctx, head)) { while (!match_eof(ctx)) { int p = ctx->bufpos; if (match_eol(ctx)) { if (ctx->buffer.buf[p - 1] != '\\') break; } else { match_character_any(ctx); } } return TRUE; } return FALSE; } static bool_t match_section_block_(context_t *ctx, const char *left, const char *right, const char *name) { int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; if (match_string(ctx, left)) { while (!match_string(ctx, right)) { if (match_eof(ctx)) { print_error("%s:%d:%d: Premature EOF in %s\n", ctx->iname, l + 1, m + 1, name); ctx->errnum++; break; } if (!match_eol(ctx)) match_character_any(ctx); } return TRUE; } return FALSE; } static bool_t match_quotation_(context_t *ctx, const char *left, const char *right, const char *name) { int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; if (match_string(ctx, left)) { while (!match_string(ctx, right)) { if (match_eof(ctx)) { print_error("%s:%d:%d: Premature EOF in %s\n", ctx->iname, l + 1, m + 1, name); ctx->errnum++; break; } if (match_character(ctx, '\\')) { if (!match_eol(ctx)) match_character_any(ctx); } else { if (match_eol(ctx)) { print_error("%s:%d:%d: Premature EOL in %s\n", ctx->iname, l + 1, m + 1, name); ctx->errnum++; break; } match_character_any(ctx); } } return TRUE; } return FALSE; } static bool_t match_directive_c(context_t *ctx) { return match_section_line_continuable_(ctx, "#"); } static bool_t match_comment(context_t *ctx) { return match_section_line_(ctx, "#"); } static bool_t match_comment_c(context_t *ctx) { return match_section_block_(ctx, "/*", "*/", "C comment"); } static bool_t match_comment_cxx(context_t *ctx) { return match_section_line_(ctx, "//"); } static bool_t match_quotation_single(context_t *ctx) { return match_quotation_(ctx, "\'", "\'", "single quotation"); } static bool_t match_quotation_double(context_t *ctx) { return match_quotation_(ctx, "\"", "\"", "double quotation"); } static bool_t match_character_class(context_t *ctx) { return match_quotation_(ctx, "[", "]", "character class"); } static bool_t match_spaces(context_t *ctx) { int n = 0; while (match_blank(ctx) || match_eol(ctx) || match_comment(ctx)) n++; return (n > 0) ? TRUE : FALSE; } static bool_t match_number(context_t *ctx) { if (match_character_range(ctx, '0', '9')) { while (match_character_range(ctx, '0', '9')); return TRUE; } return FALSE; } static bool_t match_identifier(context_t *ctx) { if ( match_character_range(ctx, 'a', 'z') || match_character_range(ctx, 'A', 'Z') || match_character(ctx, '_') ) { while ( match_character_range(ctx, 'a', 'z') || match_character_range(ctx, 'A', 'Z') || match_character_range(ctx, '0', '9') || match_character(ctx, '_') ); return TRUE; } return FALSE; } static bool_t match_code_block(context_t *ctx) { int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; if (match_character(ctx, '{')) { int d = 1; for (;;) { if (match_eof(ctx)) { print_error("%s:%d:%d: Premature EOF in code block\n", ctx->iname, l + 1, m + 1); ctx->errnum++; break; } if ( match_directive_c(ctx) || match_comment_c(ctx) || match_comment_cxx(ctx) || match_quotation_single(ctx) || match_quotation_double(ctx) ) continue; if (match_character(ctx, '{')) { d++; } else if (match_character(ctx, '}')) { d--; if (d == 0) break; } else { if (!match_eol(ctx)) { if (match_character(ctx, '$')) { ctx->buffer.buf[ctx->bufpos - 1] = '_'; } else { match_character_any(ctx); } } } } return TRUE; } return FALSE; } static bool_t match_footer_start(context_t *ctx) { return match_string(ctx, "%%"); } static node_t *parse_expression(context_t *ctx, node_t *rule); static node_t *parse_primary(context_t *ctx, node_t *rule) { int p = ctx->bufpos; int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; node_t *n_p = NULL; if (match_identifier(ctx)) { int q = ctx->bufpos, r = -1, s = -1; match_spaces(ctx); if (match_character(ctx, ':')) { match_spaces(ctx); r = ctx->bufpos; if (!match_identifier(ctx)) goto EXCEPTION; s = ctx->bufpos; match_spaces(ctx); } if (match_string(ctx, "<-")) goto EXCEPTION; n_p = create_node(NODE_REFERENCE); if (r < 0) { n_p->data.reference.var = NULL; n_p->data.reference.index = -1; n_p->data.reference.name = strndup_e(ctx->buffer.buf + p, q - p); } else { n_p->data.reference.var = strndup_e(ctx->buffer.buf + p, q - p); { int i; for (i = 0; i < rule->data.rule.vars.len; i++) { assert(rule->data.rule.vars.buf[i]->type == NODE_REFERENCE); if (strcmp(n_p->data.reference.var, rule->data.rule.vars.buf[i]->data.reference.var) == 0) break; } if (i == rule->data.rule.vars.len) node_const_array__add(&rule->data.rule.vars, n_p); n_p->data.reference.index = i; } n_p->data.reference.name = strndup_e(ctx->buffer.buf + r, s - r); } n_p->data.reference.line = l; n_p->data.reference.col = m; } else if (match_character(ctx, '(')) { match_spaces(ctx); n_p = parse_expression(ctx, rule); if (n_p == NULL) goto EXCEPTION; if (!match_character(ctx, ')')) goto EXCEPTION; match_spaces(ctx); } else if (match_character(ctx, '<')) { match_spaces(ctx); n_p = create_node(NODE_CAPTURE); n_p->data.capture.index = rule->data.rule.capts.len; node_const_array__add(&rule->data.rule.capts, n_p); n_p->data.capture.expr = parse_expression(ctx, rule); if (n_p->data.capture.expr == NULL || !match_character(ctx, '>')) { rule->data.rule.capts.len = n_p->data.capture.index; goto EXCEPTION; } match_spaces(ctx); } else if (match_character(ctx, '$')) { match_spaces(ctx); p = ctx->bufpos; if (match_number(ctx)) { int q = ctx->bufpos; char *s; match_spaces(ctx); n_p = create_node(NODE_EXPAND); s = strndup_e(ctx->buffer.buf + p, q - p); n_p->data.expand.index = atoi(s); if (n_p->data.expand.index == 0) { print_error("%s:%d:%d: 0 not allowed\n", ctx->iname, l + 1, m + 1); ctx->errnum++; } else if (s[0] == '0') { print_error("%s:%d:%d: 0-prefixed number not allowed\n", ctx->iname, l + 1, m + 1); ctx->errnum++; } free(s); n_p->data.expand.index--; n_p->data.expand.line = l; n_p->data.expand.col = m; } else { goto EXCEPTION; } } else if (match_character(ctx, '.')) { match_spaces(ctx); n_p = create_node(NODE_CHARCLASS); n_p->data.charclass.value = NULL; } else if (match_character_class(ctx)) { int q = ctx->bufpos; match_spaces(ctx); n_p = create_node(NODE_CHARCLASS); n_p->data.charclass.value = strndup_e(ctx->buffer.buf + p + 1, q - p - 2); if (!unescape_string(n_p->data.charclass.value)) { print_error("%s:%d:%d: Illegal escape sequence\n", ctx->iname, l + 1, m + 1); ctx->errnum++; } } else if (match_quotation_single(ctx) || match_quotation_double(ctx)) { int q = ctx->bufpos; match_spaces(ctx); n_p = create_node(NODE_STRING); n_p->data.string.value = strndup_e(ctx->buffer.buf + p + 1, q - p - 2); if (!unescape_string(n_p->data.string.value)) { print_error("%s:%d:%d: Illegal escape sequence\n", ctx->iname, l + 1, m + 1); ctx->errnum++; } } else if (match_code_block(ctx)) { int q = ctx->bufpos; match_spaces(ctx); n_p = create_node(NODE_ACTION); n_p->data.action.value = strndup_e(ctx->buffer.buf + p + 1, q - p - 2); n_p->data.action.index = rule->data.rule.codes.len; node_const_array__add(&rule->data.rule.codes, n_p); } else { goto EXCEPTION; } return n_p; EXCEPTION:; destroy_node(n_p); ctx->bufpos = p; ctx->linenum = l; ctx->linepos = p - m; return NULL; } static node_t *parse_term(context_t *ctx, node_t *rule) { int p = ctx->bufpos; int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; node_t *n_p = NULL; node_t *n_q = NULL; node_t *n_r = NULL; node_t *n_t = NULL; char t = match_character(ctx, '&') ? '&' : match_character(ctx, '!') ? '!' : '\0'; if (t) match_spaces(ctx); n_p = parse_primary(ctx, rule); if (n_p == NULL) goto EXCEPTION; if (match_character(ctx, '*')) { match_spaces(ctx); n_q = create_node(NODE_QUANTITY); n_q->data.quantity.min = 0; n_q->data.quantity.max = -1; n_q->data.quantity.expr = n_p; } else if (match_character(ctx, '+')) { match_spaces(ctx); n_q = create_node(NODE_QUANTITY); n_q->data.quantity.min = 1; n_q->data.quantity.max = -1; n_q->data.quantity.expr = n_p; } else if (match_character(ctx, '?')) { match_spaces(ctx); n_q = create_node(NODE_QUANTITY); n_q->data.quantity.min = 0; n_q->data.quantity.max = 1; n_q->data.quantity.expr = n_p; } else { n_q = n_p; } switch (t) { case '&': n_r = create_node(NODE_PREDICATE); n_r->data.predicate.neg = FALSE; n_r->data.predicate.expr = n_q; break; case '!': n_r = create_node(NODE_PREDICATE); n_r->data.predicate.neg = TRUE; n_r->data.predicate.expr = n_q; break; default: n_r = n_q; } if (match_character(ctx, '&')) { match_spaces(ctx); p = ctx->bufpos; if (match_code_block(ctx)) { int q = ctx->bufpos; match_spaces(ctx); n_t = create_node(NODE_TEST); n_t->data.test.expr = n_r; n_t->data.test.value = strndup_e(ctx->buffer.buf + p + 1, q - p - 2); n_t->data.test.index = rule->data.rule.codes.len; node_const_array__add(&rule->data.rule.codes, n_t); } else { goto EXCEPTION; } } else if (match_character(ctx, '~')) { match_spaces(ctx); p = ctx->bufpos; if (match_code_block(ctx)) { int q = ctx->bufpos; match_spaces(ctx); n_t = create_node(NODE_ERROR); n_t->data.error.expr = n_r; n_t->data.error.value = strndup_e(ctx->buffer.buf + p + 1, q - p - 2); n_t->data.error.index = rule->data.rule.codes.len; node_const_array__add(&rule->data.rule.codes, n_t); } else { goto EXCEPTION; } } else { n_t = n_r; } return n_t; EXCEPTION:; destroy_node(n_r); ctx->bufpos = p; ctx->linenum = l; ctx->linepos = p - m; return NULL; } static node_t *parse_sequence(context_t *ctx, node_t *rule) { int p = ctx->bufpos; int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; node_array_t *a_t = NULL; node_t *n_t = NULL; node_t *n_u = NULL; node_t *n_s = NULL; n_t = parse_term(ctx, rule); if (n_t == NULL) goto EXCEPTION; n_u = parse_term(ctx, rule); if (n_u != NULL) { n_s = create_node(NODE_SEQUENCE); a_t = &n_s->data.sequence.nodes; node_array__add(a_t, n_t); node_array__add(a_t, n_u); while ((n_t = parse_term(ctx, rule)) != NULL) { node_array__add(a_t, n_t); } } else { n_s = n_t; } return n_s; EXCEPTION:; ctx->bufpos = p; ctx->linenum = l; ctx->linepos = p - m; return NULL; } static node_t *parse_expression(context_t *ctx, node_t *rule) { int p = ctx->bufpos, q; int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; node_array_t *a_s = NULL; node_t *n_s = NULL; node_t *n_e = NULL; n_s = parse_sequence(ctx, rule); if (n_s == NULL) goto EXCEPTION; q = ctx->bufpos; if (match_character(ctx, '/')) { ctx->bufpos = q; n_e = create_node(NODE_ALTERNATE); a_s = &n_e->data.alternate.nodes; node_array__add(a_s, n_s); while (match_character(ctx, '/')) { match_spaces(ctx); n_s = parse_sequence(ctx, rule); if (n_s == NULL) goto EXCEPTION; node_array__add(a_s, n_s); } } else { n_e = n_s; } return n_e; EXCEPTION:; destroy_node(n_e); ctx->bufpos = p; ctx->linenum = l; ctx->linepos = p - m; return NULL; } static node_t *parse_rule(context_t *ctx) { int p = ctx->bufpos, q; int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; node_t *n_r = NULL; if (!match_identifier(ctx)) goto EXCEPTION; q = ctx->bufpos; match_spaces(ctx); if (!match_string(ctx, "<-")) goto EXCEPTION; match_spaces(ctx); n_r = create_node(NODE_RULE); n_r->data.rule.expr = parse_expression(ctx, n_r); if (n_r->data.rule.expr == NULL) goto EXCEPTION; n_r->data.rule.name = strndup_e(ctx->buffer.buf + p, q - p); n_r->data.rule.line = l; n_r->data.rule.col = m; return n_r; EXCEPTION:; destroy_node(n_r); ctx->bufpos = p; ctx->linenum = l; ctx->linepos = p - m; return NULL; } static const char *get_value_type(context_t *ctx) { return (ctx->vtype && ctx->vtype[0]) ? ctx->vtype : "int"; } static const char *get_auxil_type(context_t *ctx) { return (ctx->atype && ctx->atype[0]) ? ctx->atype : "void *"; } static const char *get_prefix(context_t *ctx) { return (ctx->prefix && ctx->prefix[0]) ? ctx->prefix : "pcc"; } static void dump_options(context_t *ctx) { fprintf(stdout, "value_type:'%s'\n", get_value_type(ctx)); fprintf(stdout, "auxil_type:'%s'\n", get_auxil_type(ctx)); fprintf(stdout, "prefix:'%s'\n", get_prefix(ctx)); } static bool_t parse_directive_include_(context_t *ctx, const char *name, FILE *output1, FILE *output2) { int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; if (!match_string(ctx, name)) return FALSE; match_spaces(ctx); { int p = ctx->bufpos; if (match_code_block(ctx)) { int q = ctx->bufpos; match_spaces(ctx); if (output1 != NULL) { write_code_block(output1, ctx->buffer.buf + p + 1, q - p - 2, 0); fputc('\n', output1); } if (output2 != NULL) { write_code_block(output2, ctx->buffer.buf + p + 1, q - p - 2, 0); fputc('\n', output2); } } else { print_error("%s:%d:%d: Illegal %s syntax\n", ctx->iname, l + 1, m + 1, name); ctx->errnum++; } } return TRUE; } static bool_t parse_directive_string_(context_t *ctx, const char *name, char **output, string_flag_t mode) { int l = ctx->linenum; int m = ctx->bufpos - ctx->linepos; if (!match_string(ctx, name)) return FALSE; match_spaces(ctx); { char *s = NULL; int p = ctx->bufpos, q; int lv = ctx->linenum; int mv = ctx->bufpos - ctx->linepos; if (match_quotation_single(ctx) || match_quotation_double(ctx)) { q = ctx->bufpos; match_spaces(ctx); s = strndup_e(ctx->buffer.buf + p + 1, q - p - 2); if (!unescape_string(s)) { print_error("%s:%d:%d: Illegal escape sequence\n", ctx->iname, lv + 1, mv + 1); ctx->errnum++; } } else { print_error("%s:%d:%d: Illegal %s syntax\n", ctx->iname, l + 1, m + 1, name); ctx->errnum++; } if (s != NULL) { string_flag_t f = STRING_FLAG__NONE; bool_t b = TRUE; remove_heading_blank(s); remove_trailing_blank(s); assert((mode & ~7u) == 0); if ((mode & STRING_FLAG__NOTEMPTY) && !is_filled_string(s)) { print_error("%s:%d:%d: Empty string\n", ctx->iname, lv + 1, mv + 1); ctx->errnum++; f |= STRING_FLAG__NOTEMPTY; } if ((mode & STRING_FLAG__NOTVOID) && strcmp(s, "void") == 0) { print_error("%s:%d:%d: 'void' not allowed\n", ctx->iname, lv + 1, mv + 1); ctx->errnum++; f |= STRING_FLAG__NOTVOID; } if ((mode & STRING_FLAG__IDENTIFIER) && !is_identifier_string(s)) { if (!(f & STRING_FLAG__NOTEMPTY)) { print_error("%s:%d:%d: Invalid identifier\n", ctx->iname, lv + 1, mv + 1); ctx->errnum++; } f |= STRING_FLAG__IDENTIFIER; } if (*output != NULL) { print_error("%s:%d:%d: Multiple %s definition\n", ctx->iname, l + 1, m + 1, name); ctx->errnum++; b = FALSE; } if (f == STRING_FLAG__NONE && b) { *output = s; } else { free(s); s = NULL; } } } return TRUE; } static bool_t parse(context_t *ctx) { fprintf(ctx->sfile, "/* A packrat parser generated by PackCC %s */\n\n", VERSION); fprintf(ctx->hfile, "/* A packrat parser generated by PackCC %s */\n\n", VERSION); { fputs( "#ifdef _MSC_VER\n" "#undef _CRT_SECURE_NO_WARNINGS\n" "#define _CRT_SECURE_NO_WARNINGS\n" "#endif /* _MSC_VER */\n" "#include <stdio.h>\n" "#include <stdlib.h>\n" "#include <string.h>\n" "\n" "#ifndef _MSC_VER\n" "#if defined __GNUC__ && defined _WIN32 /* MinGW */\n" "static size_t strnlen(const char *str, size_t maxlen) {\n" " size_t i;\n" " for (i = 0; str[i] && i < maxlen; i++);\n" " return i;\n" "}\n" "#else\n" "#include <unistd.h> /* for strnlen() */\n" "#endif /* defined __GNUC__ && defined _WIN32 */ \n" "#endif /* _MSC_VER */\n" "\n", ctx->sfile ); fprintf( ctx->sfile, "#include \"%s\"\n" "\n", ctx->hname ); } { fprintf( ctx->hfile, "#ifndef PCC_INCLUDED__%s\n" "#define PCC_INCLUDED__%s\n" "\n", ctx->hid, ctx->hid ); } { bool_t b = TRUE; match_spaces(ctx); for (;;) { int p, l, m; if (match_eof(ctx) || match_footer_start(ctx)) break; p = ctx->bufpos; l = ctx->linenum; m = ctx->bufpos - ctx->linepos; if ( parse_directive_include_(ctx, "%source", ctx->sfile, NULL) || parse_directive_include_(ctx, "%header", ctx->hfile, NULL) || parse_directive_include_(ctx, "%common", ctx->sfile, ctx->hfile) || parse_directive_string_(ctx, "%value", &ctx->vtype, STRING_FLAG__NOTEMPTY | STRING_FLAG__NOTVOID) || parse_directive_string_(ctx, "%auxil", &ctx->atype, STRING_FLAG__NOTEMPTY | STRING_FLAG__NOTVOID) || parse_directive_string_(ctx, "%prefix", &ctx->prefix, STRING_FLAG__NOTEMPTY | STRING_FLAG__IDENTIFIER) ) { b = TRUE; } else if (match_character(ctx, '%')) { print_error("%s:%d:%d: Invalid directive\n", ctx->iname, l + 1, m + 1); ctx->errnum++; match_identifier(ctx); match_spaces(ctx); b = TRUE; } else { node_t *n_r = parse_rule(ctx); if (n_r == NULL) { if (b) { print_error("%s:%d:%d: Illegal rule syntax\n", ctx->iname, l + 1, m + 1); ctx->errnum++; b = FALSE; } ctx->linenum = l; ctx->linepos = p - m; if (!match_identifier(ctx) && !match_spaces(ctx)) match_character_any(ctx); continue; } node_array__add(&ctx->rules, n_r); b = TRUE; } commit_buffer(ctx); } commit_buffer(ctx); } { int i; make_rulehash(ctx); for (i = 0; i < ctx->rules.len; i++) { link_references(ctx, ctx->rules.buf[i]->data.rule.expr); } for (i = 1; i < ctx->rules.len; i++) { if (ctx->rules.buf[i]->data.rule.ref == 0) { print_error("%s:%d:%d: Never used rule '%s'\n", ctx->iname, ctx->rules.buf[i]->data.rule.line + 1, ctx->rules.buf[i]->data.rule.col + 1, ctx->rules.buf[i]->data.rule.name); /* ctx->errnum++; */ } else if (ctx->rules.buf[i]->data.rule.ref < 0) { print_error("%s:%d:%d: Multiple definition of rule '%s'\n", ctx->iname, ctx->rules.buf[i]->data.rule.line + 1, ctx->rules.buf[i]->data.rule.col + 1, ctx->rules.buf[i]->data.rule.name); ctx->errnum++; } } } { int i; for (i = 0; i < ctx->rules.len; i++) { verify_variables(ctx, ctx->rules.buf[i]->data.rule.expr, NULL); verify_captures(ctx, ctx->rules.buf[i]->data.rule.expr, NULL); } } if (ctx->debug) { int i; for (i = 0; i < ctx->rules.len; i++) { dump_node(ctx, ctx->rules.buf[i]); } dump_options(ctx); } return (ctx->errnum == 0) ? TRUE : FALSE; } static code_reach_t generate_matching_string_code(generate_t *gen, const char *value, int onfail, int indent, bool_t bare) { int n = (value != NULL) ? (int)strlen(value) : 0; if (n > 0) { char s[5]; if (n > 1) { int i; if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } write_characters(gen->stream, ' ', indent); fputs("const char *s = ctx->buffer.buf + ctx->pos;\n", gen->stream); write_characters(gen->stream, ' ', indent); fputs("if (\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fprintf(gen->stream, "pcc_refill_buffer(ctx, %d) < %d ||\n", n, n); for (i = 0; i < n - 1; i++) { write_characters(gen->stream, ' ', indent + 4); fprintf(gen->stream, "s[%d] != '%s' ||\n", i, escape_character(value[i], &s)); } write_characters(gen->stream, ' ', indent + 4); fprintf(gen->stream, "s[%d] != '%s'\n", i, escape_character(value[i], &s)); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, ") goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "ctx->pos += %d;\n", n); if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return CODE_REACH__BOTH; } else { write_characters(gen->stream, ' ', indent); fputs("if (\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fputs("pcc_refill_buffer(ctx, 1) < 1 ||\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fprintf(gen->stream, "ctx->buffer.buf[ctx->pos] != '%s'\n", escape_character(value[0], &s)); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, ") goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent); fputs("ctx->pos++;\n", gen->stream); return CODE_REACH__BOTH; } } else { /* no code to generate */ return CODE_REACH__ALWAYS_SUCCEED; } } static code_reach_t generate_matching_charclass_code(generate_t *gen, const char *value, int onfail, int indent, bool_t bare) { if (value != NULL) { size_t n = strlen(value); if (n > 0) { char s[5], t[5]; if (n > 1) { bool_t a = (value[0] == '^') ? TRUE : FALSE; size_t i = a ? 1 : 0; if (i + 1 == n) { /* fulfilled only if a == TRUE */ write_characters(gen->stream, ' ', indent); fputs("if (\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fputs("pcc_refill_buffer(ctx, 1) < 1 ||\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fprintf(gen->stream, "ctx->buffer.buf[ctx->pos] == '%s'\n", escape_character(value[i], &s)); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, ") goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent); fputs("ctx->pos++;\n", gen->stream); return CODE_REACH__BOTH; } else { if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } write_characters(gen->stream, ' ', indent); fputs("char c;\n", gen->stream); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "if (pcc_refill_buffer(ctx, 1) < 1) goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent); fputs("c = ctx->buffer.buf[ctx->pos];\n", gen->stream); if (i + 3 == n && value[i + 1] == '-') { write_characters(gen->stream, ' ', indent); fprintf(gen->stream, a ? "if (c >= '%s' && c <= '%s') goto L%04d;\n" : "if (!(c >= '%s' && c <= '%s')) goto L%04d;\n", escape_character(value[i], &s), escape_character(value[i + 2], &t), onfail); } else { write_characters(gen->stream, ' ', indent); fputs(a ? "if (\n" : "if (!(\n", gen->stream); for (; i < n; i++) { write_characters(gen->stream, ' ', indent + 4); if (i + 2 < n && value[i + 1] == '-') { fprintf(gen->stream, "(c >= '%s' && c <= '%s')%s\n", escape_character(value[i], &s), escape_character(value[i + 2], &t), (i + 3 == n) ? "" : " ||"); i += 2; } else { fprintf(gen->stream, "c == '%s'%s\n", escape_character(value[i], &s), (i + 1 == n) ? "" : " ||"); } } write_characters(gen->stream, ' ', indent); fprintf(gen->stream, a ? ") goto L%04d;\n" : ")) goto L%04d;\n", onfail); } write_characters(gen->stream, ' ', indent); fputs("ctx->pos++;\n", gen->stream); if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return CODE_REACH__BOTH; } } else { write_characters(gen->stream, ' ', indent); fputs("if (\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fputs("pcc_refill_buffer(ctx, 1) < 1 ||\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fprintf(gen->stream, "ctx->buffer.buf[ctx->pos] != '%s'\n", escape_character(value[0], &s)); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, ") goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent); fputs("ctx->pos++;\n", gen->stream); return CODE_REACH__BOTH; } } else { write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "goto L%04d;\n", onfail); return CODE_REACH__ALWAYS_FAIL; } } else { write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "if (pcc_refill_buffer(ctx, 1) < 1) goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent); fputs("ctx->pos++;\n", gen->stream); return CODE_REACH__BOTH; } } static code_reach_t generate_code(generate_t *gen, const node_t *node, int onfail, int indent, bool_t bare); static code_reach_t generate_quantifying_code(generate_t *gen, const node_t *expr, int min, int max, int onfail, int indent, bool_t bare) { if (max > 1 || max < 0) { code_reach_t r; if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } if (min > 0) { write_characters(gen->stream, ' ', indent); fputs("int p = ctx->pos;\n", gen->stream); } write_characters(gen->stream, ' ', indent); fputs("int i;\n", gen->stream); write_characters(gen->stream, ' ', indent); if (max < 0) fputs("for (i = 0;; i++) {\n", gen->stream); else fprintf(gen->stream, "for (i = 0; i < %d; i++) {\n", max); { int l = ++gen->label; r = generate_code(gen, expr, l, indent + 4, TRUE); write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); if (r != CODE_REACH__ALWAYS_SUCCEED) { write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", l); } else if (max < 0) { print_error("Warning: Infinite loop detected in generated code\n"); } } if (min > 0) { write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "if (i < %d) {\n", min); write_characters(gen->stream, ' ', indent + 4); fputs("ctx->pos = p;\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fprintf(gen->stream, "goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return (min > 0) ? ((r == CODE_REACH__ALWAYS_FAIL) ? CODE_REACH__ALWAYS_FAIL : CODE_REACH__BOTH) : CODE_REACH__ALWAYS_SUCCEED; } else if (max == 1) { if (min > 0) { return generate_code(gen, expr, onfail, indent, bare); } else { int l = ++gen->label; if (generate_code(gen, expr, l, indent, bare) != CODE_REACH__ALWAYS_SUCCEED) { write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", l); } return CODE_REACH__ALWAYS_SUCCEED; } } else { /* no code to generate */ return CODE_REACH__ALWAYS_SUCCEED; } } static code_reach_t generate_predicating_code(generate_t *gen, const node_t *expr, bool_t neg, int onfail, int indent, bool_t bare) { code_reach_t r; if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } write_characters(gen->stream, ' ', indent); fputs("int p = ctx->pos;\n", gen->stream); if (neg) { int l = ++gen->label; r = generate_code(gen, expr, l, indent, FALSE); if (r != CODE_REACH__ALWAYS_FAIL) { write_characters(gen->stream, ' ', indent); fputs("ctx->pos = p;\n", gen->stream); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "goto L%04d;\n", onfail); } if (r != CODE_REACH__ALWAYS_SUCCEED) { write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", l); write_characters(gen->stream, ' ', indent); fputs("ctx->pos = p;\n", gen->stream); } switch (r) { case CODE_REACH__ALWAYS_SUCCEED: r = CODE_REACH__ALWAYS_FAIL; break; case CODE_REACH__ALWAYS_FAIL: r = CODE_REACH__ALWAYS_SUCCEED; break; case CODE_REACH__BOTH: break; } } else { int l = ++gen->label; int m = ++gen->label; r = generate_code(gen, expr, l, indent, FALSE); if (r != CODE_REACH__ALWAYS_FAIL) { write_characters(gen->stream, ' ', indent); fputs("ctx->pos = p;\n", gen->stream); } if (r == CODE_REACH__BOTH) { write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "goto L%04d;\n", m); } if (r != CODE_REACH__ALWAYS_SUCCEED) { write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", l); write_characters(gen->stream, ' ', indent); fputs("ctx->pos = p;\n", gen->stream); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "goto L%04d;\n", onfail); } if (r == CODE_REACH__BOTH) { write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", m); } } if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return r; } static code_reach_t generate_sequential_code(generate_t *gen, const node_array_t *nodes, int onfail, int indent, bool_t bare) { bool_t b = FALSE; int i; for (i = 0; i < nodes->len; i++) { switch (generate_code(gen, nodes->buf[i], onfail, indent, FALSE)) { case CODE_REACH__ALWAYS_FAIL: if (i < nodes->len - 1) { write_characters(gen->stream, ' ', indent); fputs("/* unreachable codes omitted */\n", gen->stream); } return CODE_REACH__ALWAYS_FAIL; case CODE_REACH__ALWAYS_SUCCEED: break; default: b = TRUE; } } return b ? CODE_REACH__BOTH : CODE_REACH__ALWAYS_SUCCEED; } static code_reach_t generate_alternative_code(generate_t *gen, const node_array_t *nodes, int onfail, int indent, bool_t bare) { bool_t b = FALSE; int i, m = ++gen->label; if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } write_characters(gen->stream, ' ', indent); fputs("int p = ctx->pos;\n", gen->stream); write_characters(gen->stream, ' ', indent); fputs("int n = chunk->thunks.len;\n", gen->stream); for (i = 0; i < nodes->len; i++) { bool_t c = (i < nodes->len - 1) ? TRUE : FALSE; int l = ++gen->label; switch (generate_code(gen, nodes->buf[i], l, indent, FALSE)) { case CODE_REACH__ALWAYS_SUCCEED: if (c) { write_characters(gen->stream, ' ', indent); fputs("/* unreachable codes omitted */\n", gen->stream); } if (b) { write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", m); } if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return CODE_REACH__ALWAYS_SUCCEED; case CODE_REACH__ALWAYS_FAIL: break; default: b = TRUE; write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "goto L%04d;\n", m); } write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", l); write_characters(gen->stream, ' ', indent); fputs("ctx->pos = p;\n", gen->stream); write_characters(gen->stream, ' ', indent); fputs("pcc_thunk_array__revert(ctx->auxil, &chunk->thunks, n);\n", gen->stream); if (!c) { write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "goto L%04d;\n", onfail); } } if (b) { write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", m); } if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return b ? CODE_REACH__BOTH : CODE_REACH__ALWAYS_FAIL; } static code_reach_t generate_capturing_code(generate_t *gen, const node_t *expr, int index, int onfail, int indent, bool_t bare) { code_reach_t r; if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } write_characters(gen->stream, ' ', indent); fputs("int p = ctx->pos, q;\n", gen->stream); r = generate_code(gen, expr, onfail, indent, FALSE); write_characters(gen->stream, ' ', indent); fputs("q = ctx->pos;\n", gen->stream); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "chunk->capts.buf[%d].range.start = p;\n", index); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "chunk->capts.buf[%d].range.end = q;\n", index); if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return r; } static code_reach_t generate_expanding_code(generate_t *gen, int index, int onfail, int indent, bool_t bare) { if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "int n = chunk->capts.buf[%d].range.end - chunk->capts.buf[%d].range.start;\n", index, index); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "if (pcc_refill_buffer(ctx, n) < n) goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent); fputs("if (n > 0) {\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fputs("const char *p = ctx->buffer.buf + ctx->pos;\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fprintf(gen->stream, "const char *q = ctx->buffer.buf + chunk->capts.buf[%d].range.start;\n", index); write_characters(gen->stream, ' ', indent + 4); fputs("int i;\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fputs("for (i = 0; i < n; i++) {\n", gen->stream); write_characters(gen->stream, ' ', indent + 8); fprintf(gen->stream, "if (p[i] != q[i]) goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent + 4); fputs("}\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fputs("ctx->pos += n;\n", gen->stream); write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return CODE_REACH__BOTH; } code_reach_t generate_thunking_action_code( generate_t *gen, int index, const node_const_array_t *vars, const node_const_array_t *capts, bool_t error, int onfail, int indent, bool_t bare, bool_t test ) { assert(gen->rule->type == NODE_RULE); if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } if (error || test) { write_characters(gen->stream, ' ', indent); fputs("pcc_value_t null;\n", gen->stream); } write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "pcc_thunk_t *thunk = pcc_thunk__create_leaf(ctx->auxil, (void *)pcc_action_%s_%d, %d, %d);\n", gen->rule->data.rule.name, index, gen->rule->data.rule.vars.len, gen->rule->data.rule.capts.len); { int i; for (i = 0; i < vars->len; i++) { assert(vars->buf[i]->type == NODE_REFERENCE); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "thunk->data.leaf.values.buf[%d] = &(chunk->values.buf[%d]);\n", vars->buf[i]->data.reference.index, vars->buf[i]->data.reference.index); } for (i = 0; i < capts->len; i++) { assert(capts->buf[i]->type == NODE_CAPTURE); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "thunk->data.leaf.capts.buf[%d] = &(chunk->capts.buf[%d]);\n", capts->buf[i]->data.capture.index, capts->buf[i]->data.capture.index); } write_characters(gen->stream, ' ', indent); fputs("thunk->data.leaf.capt0.range.start = chunk->pos;\n", gen->stream); write_characters(gen->stream, ' ', indent); fputs("thunk->data.leaf.capt0.range.end = ctx->pos;\n", gen->stream); } if (error) { write_characters(gen->stream, ' ', indent); fputs("memset(&null, 0, sizeof(pcc_value_t)); /* in case */\n", gen->stream); write_characters(gen->stream, ' ', indent); fputs("thunk->data.leaf.action(ctx, thunk, &null);\n", gen->stream); write_characters(gen->stream, ' ', indent); fputs("pcc_thunk__destroy(ctx->auxil, thunk);\n", gen->stream); } else if (test) { write_characters(gen->stream, ' ', indent); fputs("memset(&null, 0, sizeof(pcc_value_t)); /* in case */\n", gen->stream); write_characters(gen->stream, ' ', indent); fputs("if (!((pcc_action_int_t)thunk->data.leaf.action)(ctx, thunk, &null)) {\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fputs("pcc_thunk__destroy(ctx->auxil, thunk);\n", gen->stream); write_characters(gen->stream, ' ', indent + 4); fprintf(gen->stream, "goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); write_characters(gen->stream, ' ', indent); fputs("pcc_thunk__destroy(ctx->auxil, thunk);\n", gen->stream); } else { write_characters(gen->stream, ' ', indent); fputs("pcc_thunk_array__add(ctx->auxil, &chunk->thunks, thunk);\n", gen->stream); } if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return CODE_REACH__ALWAYS_SUCCEED; } code_reach_t generate_thunking_test_code( generate_t *gen, const node_t *expr, int index, const node_const_array_t *vars, const node_const_array_t *capts, int onfail, int indent, bool_t bare ) { code_reach_t r; int l = gen->label; assert(gen->rule->type == NODE_RULE); if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } r = generate_code(gen, expr, l, indent, TRUE); generate_thunking_action_code(gen, index, vars, capts, FALSE, l, indent, FALSE, TRUE); if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return r; } code_reach_t generate_thunking_error_code( generate_t *gen, const node_t *expr, int index, const node_const_array_t *vars, const node_const_array_t *capts, int onfail, int indent, bool_t bare ) { code_reach_t r; int l = ++gen->label; int m = ++gen->label; assert(gen->rule->type == NODE_RULE); if (!bare) { write_characters(gen->stream, ' ', indent); fputs("{\n", gen->stream); indent += 4; } r = generate_code(gen, expr, l, indent, TRUE); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "goto L%04d;\n", m); write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", l); generate_thunking_action_code(gen, index, vars, capts, TRUE, l, indent, FALSE, FALSE); write_characters(gen->stream, ' ', indent); fprintf(gen->stream, "goto L%04d;\n", onfail); write_characters(gen->stream, ' ', indent - 4); fprintf(gen->stream, "L%04d:;\n", m); if (!bare) { indent -= 4; write_characters(gen->stream, ' ', indent); fputs("}\n", gen->stream); } return r; } static code_reach_t generate_code(generate_t *gen, const node_t *node, int onfail, int indent, bool_t bare) { if (node == NULL) { print_error("Internal error [%d]\n", __LINE__); exit(-1); } switch (node->type) { case NODE_RULE: print_error("Internal error [%d]\n", __LINE__); exit(-1); case NODE_REFERENCE: write_characters(gen->stream, ' ', indent); if (node->data.reference.index >= 0) { fprintf(gen->stream, "if (!pcc_apply_rule(ctx, pcc_evaluate_rule_%s, &chunk->thunks, &(chunk->values.buf[%d]))) goto L%04d;\n", node->data.reference.name, node->data.reference.index, onfail); } else { fprintf(gen->stream, "if (!pcc_apply_rule(ctx, pcc_evaluate_rule_%s, &chunk->thunks, NULL)) goto L%04d;\n", node->data.reference.name, onfail); } return CODE_REACH__BOTH; case NODE_STRING: return generate_matching_string_code(gen, node->data.string.value, onfail, indent, bare); case NODE_CHARCLASS: return generate_matching_charclass_code(gen, node->data.charclass.value, onfail, indent, bare); case NODE_QUANTITY: return generate_quantifying_code(gen, node->data.quantity.expr, node->data.quantity.min, node->data.quantity.max, onfail, indent, bare); case NODE_PREDICATE: return generate_predicating_code(gen, node->data.predicate.expr, node->data.predicate.neg, onfail, indent, bare); case NODE_SEQUENCE: return generate_sequential_code(gen, &node->data.sequence.nodes, onfail, indent, bare); case NODE_ALTERNATE: return generate_alternative_code(gen, &node->data.alternate.nodes, onfail, indent, bare); case NODE_CAPTURE: return generate_capturing_code(gen, node->data.capture.expr, node->data.capture.index, onfail, indent, bare); case NODE_EXPAND: return generate_expanding_code(gen, node->data.expand.index, onfail, indent, bare); case NODE_ACTION: return generate_thunking_action_code( gen, node->data.action.index, &node->data.action.vars, &node->data.action.capts, FALSE, onfail, indent, bare, FALSE ); case NODE_TEST: return generate_thunking_test_code( gen, node->data.test.expr, node->data.test.index, &node->data.test.vars, &node->data.test.capts, onfail, indent, bare ); case NODE_ERROR: return generate_thunking_error_code( gen, node->data.error.expr, node->data.error.index, &node->data.error.vars, &node->data.error.capts, onfail, indent, bare ); default: print_error("Internal error [%d]\n", __LINE__); exit(-1); } } static bool_t generate(context_t *ctx) { const char *vt = get_value_type(ctx); const char *at = get_auxil_type(ctx); bool_t vp = is_pointer_type(vt); bool_t ap = is_pointer_type(at); FILE *stream = ctx->sfile; { fputs( "#ifndef PCC_BUFFERSIZE\n" "#define PCC_BUFFERSIZE 256\n" "#endif /* PCC_BUFFERSIZE */\n" "\n" "#ifndef PCC_ARRAYSIZE\n" "#define PCC_ARRAYSIZE 2\n" "#endif /* PCC_ARRAYSIZE */\n" "\n" "typedef enum pcc_bool_tag {\n" " PCC_FALSE = 0,\n" " PCC_TRUE\n" "} pcc_bool_t;\n" "\n" "typedef struct pcc_char_array_tag {\n" " char *buf;\n" " int max;\n" " int len;\n" "} pcc_char_array_t;\n" "\n" "typedef struct pcc_range_tag {\n" " int start;\n" " int end;\n" "} pcc_range_t;\n" "\n", stream ); fprintf( stream, "typedef %s%spcc_value_t;\n" "\n", vt, vp ? "" : " " ); fprintf( stream, "typedef %s%spcc_auxil_t;\n" "\n", at, ap ? "" : " " ); fputs( "typedef struct pcc_value_table_tag {\n" " pcc_value_t *buf;\n" " int max;\n" " int len;\n" "} pcc_value_table_t;\n" "\n" "typedef struct pcc_value_refer_table_tag {\n" " pcc_value_t **buf;\n" " int max;\n" " int len;\n" "} pcc_value_refer_table_t;\n" "\n" "typedef struct pcc_capture_tag {\n" " pcc_range_t range;\n" " char *string; /* mutable */\n" "} pcc_capture_t;\n" "\n" "typedef struct pcc_capture_table_tag {\n" " pcc_capture_t *buf;\n" " int max;\n" " int len;\n" "} pcc_capture_table_t;\n" "\n" "typedef struct pcc_capture_const_table_tag {\n" " const pcc_capture_t **buf;\n" " int max;\n" " int len;\n" "} pcc_capture_const_table_t;\n" "\n" "typedef struct pcc_thunk_tag pcc_thunk_t;\n" "typedef struct pcc_thunk_array_tag pcc_thunk_array_t;\n" "\n", stream ); fprintf( stream, "typedef void (*pcc_action_t)(%s_context_t *, pcc_thunk_t *, pcc_value_t *);\n" "typedef int (*pcc_action_int_t)(%s_context_t *, pcc_thunk_t *, pcc_value_t *);\n" "\n", get_prefix(ctx), get_prefix(ctx) ); fputs( "typedef enum pcc_thunk_type_tag {\n" " PCC_THUNK_LEAF,\n" " PCC_THUNK_NODE,\n" "} pcc_thunk_type_t;\n" "\n" "typedef struct pcc_thunk_leaf_tag {\n" " pcc_value_refer_table_t values;\n" " pcc_capture_const_table_t capts;\n" " pcc_capture_t capt0;\n" " pcc_action_t action;\n" "} pcc_thunk_leaf_t;\n" "\n" "typedef struct pcc_thunk_node_tag {\n" " const pcc_thunk_array_t *thunks; /* just a reference */\n" " pcc_value_t *value; /* just a reference */\n" "} pcc_thunk_node_t;\n" "\n" "typedef union pcc_thunk_data_tag {\n" " pcc_thunk_leaf_t leaf;\n" " pcc_thunk_node_t node;\n" "} pcc_thunk_data_t;\n" "\n" "struct pcc_thunk_tag {\n" " pcc_thunk_type_t type;\n" " pcc_thunk_data_t data;\n" "};\n" "\n" "struct pcc_thunk_array_tag {\n" " pcc_thunk_t **buf;\n" " int max;\n" " int len;\n" "};\n" "\n" "typedef struct pcc_thunk_chunk_tag {\n" " pcc_value_table_t values;\n" " pcc_capture_table_t capts;\n" " pcc_thunk_array_t thunks;\n" " int pos;\n" "} pcc_thunk_chunk_t;\n" "\n" "typedef struct pcc_lr_entry_tag pcc_lr_entry_t;\n" "\n" "typedef enum pcc_lr_answer_type_tag {\n" " PCC_LR_ANSWER_LR,\n" " PCC_LR_ANSWER_CHUNK,\n" "} pcc_lr_answer_type_t;\n" "\n" "typedef union pcc_lr_answer_data_tag {\n" " pcc_lr_entry_t *lr;\n" " pcc_thunk_chunk_t *chunk;\n" "} pcc_lr_answer_data_t;\n" "\n" "typedef struct pcc_lr_answer_tag pcc_lr_answer_t;\n" "\n" "struct pcc_lr_answer_tag {\n" " pcc_lr_answer_type_t type;\n" " pcc_lr_answer_data_t data;\n" " int pos;\n" " pcc_lr_answer_t *hold;\n" "};\n" "\n", stream ); fprintf( stream, "typedef pcc_thunk_chunk_t *(*pcc_rule_t)(%s_context_t *);\n" "\n", get_prefix(ctx) ); fputs( "typedef struct pcc_rule_set_tag {\n" " pcc_rule_t *buf;\n" " int max;\n" " int len;\n" "} pcc_rule_set_t;\n" "\n" "typedef struct pcc_lr_head_tag pcc_lr_head_t;\n" "\n" "struct pcc_lr_head_tag {\n" " pcc_rule_t rule;\n" " pcc_rule_set_t invol;\n" " pcc_rule_set_t eval;\n" " pcc_lr_head_t *hold;\n" "};\n" "\n" "typedef struct pcc_lr_memo_tag {\n" " pcc_rule_t rule;\n" " pcc_lr_answer_t *answer;\n" "} pcc_lr_memo_t;\n" "\n" "typedef struct pcc_lr_memo_map_tag {\n" " pcc_lr_memo_t *buf;\n" " int max;\n" " int len;\n" "} pcc_lr_memo_map_t;\n" "\n" "typedef struct pcc_lr_table_entry_tag {\n" " pcc_lr_head_t *head; /* just a reference */\n" " pcc_lr_memo_map_t memos;\n" " pcc_lr_answer_t *hold_a;\n" " pcc_lr_head_t *hold_h;\n" "} pcc_lr_table_entry_t;\n" "\n" "typedef struct pcc_lr_table_tag {\n" " pcc_lr_table_entry_t **buf;\n" " int max;\n" " int len;\n" "} pcc_lr_table_t;\n" "\n" "struct pcc_lr_entry_tag {\n" " pcc_rule_t rule;\n" " pcc_thunk_chunk_t *seed; /* just a reference */\n" " pcc_lr_head_t *head; /* just a reference */\n" "};\n" "\n" "typedef struct pcc_lr_stack_tag {\n" " pcc_lr_entry_t **buf;\n" " int max;\n" " int len;\n" "} pcc_lr_stack_t;\n" "\n", stream ); fprintf( stream, "struct %s_context_tag {\n" " int pos;\n" " pcc_char_array_t buffer;\n" " pcc_lr_table_t lrtable;\n" " pcc_lr_stack_t lrstack;\n" " pcc_auxil_t auxil;\n" "};\n" "\n", get_prefix(ctx) ); fputs( "#ifndef PCC_ERROR\n" "#define PCC_ERROR(auxil) pcc_error()\n" "static void pcc_error(void) {\n" " fprintf(stderr, \"Syntax error\\n\");\n" " exit(1);\n" "}\n" "#endif /* PCC_ERROR */\n" "\n" "#ifndef PCC_GETCHAR\n" "#define PCC_GETCHAR(auxil) getchar()\n" "#endif /* PCC_GETCHAR */\n" "\n" "#ifndef PCC_MALLOC\n" "#define PCC_MALLOC(auxil, size) pcc_malloc_e(size)\n" "static void *pcc_malloc_e(size_t size) {\n" " void *p = malloc(size);\n" " if (p == NULL) {\n" " fprintf(stderr, \"Out of memory\\n\");\n" " exit(1);\n" " }\n" " return p;\n" "}\n" "#endif /* PCC_MALLOC */\n" "\n" "#ifndef PCC_REALLOC\n" "#define PCC_REALLOC(auxil, ptr, size) pcc_realloc_e(ptr, size)\n" "static void *pcc_realloc_e(void *ptr, size_t size) {\n" " void *p = realloc(ptr, size);\n" " if (p == NULL) {\n" " fprintf(stderr, \"Out of memory\\n\");\n" " exit(1);\n" " }\n" " return p;\n" "}\n" "#endif /* PCC_REALLOC */\n" "\n" "#ifndef PCC_FREE\n" "#define PCC_FREE(auxil, ptr) free(ptr)\n" "#endif /* PCC_FREE */\n" "\n" /* not used "static char *pcc_strdup_e(pcc_auxil_t auxil, const char *str) {\n" " size_t m = strlen(str);\n" " char *s = (char *)PCC_MALLOC(auxil, m + 1);\n" " memcpy(s, str, m);\n" " s[m] = '\\0';\n" " return s;\n" "}\n" "\n" */ "static char *pcc_strndup_e(pcc_auxil_t auxil, const char *str, size_t len) {\n" " size_t m = strnlen(str, len);\n" " char *s = (char *)PCC_MALLOC(auxil, (size_t)(m + 1));\n" " memcpy(s, str, m);\n" " s[m] = '\\0';\n" " return s;\n" "}\n" "\n" "static void pcc_char_array__init(pcc_auxil_t auxil, pcc_char_array_t *array, int max) {\n" " array->len = 0;\n" " array->max = max;\n" " array->buf = (char *)PCC_MALLOC(auxil, (size_t)array->max);\n" "}\n" "\n" "static void pcc_char_array__add(pcc_auxil_t auxil, pcc_char_array_t *array, char ch) {\n" " if (array->max <= 0) array->max = 1;\n" " while (array->max <= array->len) array->max <<= 1;\n" " array->buf = (char *)PCC_REALLOC(auxil, array->buf, (size_t)array->max);\n" " array->buf[array->len++] = ch;\n" "}\n" "\n" "static void pcc_char_array__term(pcc_auxil_t auxil, pcc_char_array_t *array) {\n" " PCC_FREE(auxil, array->buf);\n" "}\n" "\n" "static void pcc_value_table__init(pcc_auxil_t auxil, pcc_value_table_t *table, int max) {\n" " table->len = 0;\n" " table->max = max;\n" " table->buf = (pcc_value_t *)PCC_MALLOC(auxil, (size_t)table->max * sizeof(pcc_value_t));\n" "}\n" "\n" "static void pcc_value_table__resize(pcc_auxil_t auxil, pcc_value_table_t *table, int len) {\n" " if (table->max < len) {\n" " if (table->max <= 0) table->max = 1;\n" " while (table->max < len) table->max <<= 1;\n" " table->buf = (pcc_value_t *)PCC_REALLOC(auxil, table->buf, (size_t)table->max * sizeof(pcc_value_t));\n" " }\n" " table->len = len;\n" "}\n" "\n" "static void pcc_value_table__term(pcc_auxil_t auxil, pcc_value_table_t *table) {\n" " PCC_FREE(auxil, table->buf);\n" "}\n" "\n" "static void pcc_value_refer_table__init(pcc_auxil_t auxil, pcc_value_refer_table_t *table, int max) {\n" " table->len = 0;\n" " table->max = max;\n" " table->buf = (pcc_value_t **)PCC_MALLOC(auxil, (size_t)table->max * sizeof(pcc_value_t *));\n" "}\n" "\n" "static void pcc_value_refer_table__resize(pcc_auxil_t auxil, pcc_value_refer_table_t *table, int len) {\n" " int i;\n" " if (table->max < len) {\n" " if (table->max <= 0) table->max = 1;\n" " while (table->max < len) table->max <<= 1;\n" " table->buf = (pcc_value_t **)PCC_REALLOC(auxil, table->buf, (size_t)table->max * sizeof(pcc_value_t *));\n" " }\n" " for (i = table->len; i < len; i++) table->buf[i] = NULL;\n" " table->len = len;\n" "}\n" "\n" "static void pcc_value_refer_table__term(pcc_auxil_t auxil, pcc_value_refer_table_t *table) {\n" " PCC_FREE(auxil, table->buf);\n" "}\n" "\n" "static void pcc_capture_table__init(pcc_auxil_t auxil, pcc_capture_table_t *table, int max) {\n" " table->len = 0;\n" " table->max = max;\n" " table->buf = (pcc_capture_t *)PCC_MALLOC(auxil, (size_t)table->max * sizeof(pcc_capture_t));\n" "}\n" "\n" "static void pcc_capture_table__resize(pcc_auxil_t auxil, pcc_capture_table_t *table, int len) {\n" " int i;\n" " for (i = table->len - 1; i >= len; i--) PCC_FREE(auxil, table->buf[i].string);\n" " if (table->max < len) {\n" " if (table->max <= 0) table->max = 1;\n" " while (table->max < len) table->max <<= 1;\n" " table->buf = (pcc_capture_t *)PCC_REALLOC(auxil, table->buf, (size_t)table->max * sizeof(pcc_capture_t));\n" " }\n" " for (i = table->len; i < len; i++) {\n" " table->buf[i].range.start = 0;\n" " table->buf[i].range.end = 0;\n" " table->buf[i].string = NULL;\n" " }\n" " table->len = len;\n" "}\n" "\n" "static void pcc_capture_table__term(pcc_auxil_t auxil, pcc_capture_table_t *table) {\n" " int i;\n" " for (i = table->len - 1; i >= 0; i--) PCC_FREE(auxil, table->buf[i].string);\n" " PCC_FREE(auxil, table->buf);\n" "}\n" "\n" "static void pcc_capture_const_table__init(pcc_auxil_t auxil, pcc_capture_const_table_t *table, int max) {\n" " table->len = 0;\n" " table->max = max;\n" " table->buf = (const pcc_capture_t **)PCC_MALLOC(auxil, (size_t)table->max * sizeof(const pcc_capture_t *));\n" "}\n" "\n" "static void pcc_capture_const_table__resize(pcc_auxil_t auxil, pcc_capture_const_table_t *table, int len) {\n" " int i;\n" " if (table->max < len) {\n" " if (table->max <= 0) table->max = 1;\n" " while (table->max < len) table->max <<= 1;\n" " table->buf = (const pcc_capture_t **)PCC_REALLOC(auxil, (pcc_capture_t **)table->buf, (size_t)table->max * sizeof(const pcc_capture_t *));\n" " }\n" " for (i = table->len; i < len; i++) table->buf[i] = NULL;\n" " table->len = len;\n" "}\n" "\n" "static void pcc_capture_const_table__term(pcc_auxil_t auxil, pcc_capture_const_table_t *table) {\n" " PCC_FREE(auxil, (pcc_capture_t **)table->buf);\n" "}\n" "\n" "static pcc_thunk_t *pcc_thunk__create_leaf(pcc_auxil_t auxil, pcc_action_t action, int valuec, int captc) {\n" " pcc_thunk_t *thunk = (pcc_thunk_t *)PCC_MALLOC(auxil, sizeof(pcc_thunk_t));\n" " thunk->type = PCC_THUNK_LEAF;\n" " pcc_value_refer_table__init(auxil, &thunk->data.leaf.values, valuec);\n" " pcc_value_refer_table__resize(auxil, &thunk->data.leaf.values, valuec);\n" " pcc_capture_const_table__init(auxil, &thunk->data.leaf.capts, captc);\n" " pcc_capture_const_table__resize(auxil, &thunk->data.leaf.capts, captc);\n" " thunk->data.leaf.capt0.range.start = 0;\n" " thunk->data.leaf.capt0.range.end = 0;\n" " thunk->data.leaf.capt0.string = NULL;\n" " thunk->data.leaf.action = action;\n" " return thunk;\n" "}\n" "\n" "static pcc_thunk_t *pcc_thunk__create_node(pcc_auxil_t auxil, const pcc_thunk_array_t *thunks, pcc_value_t *value) {\n" " pcc_thunk_t *thunk = (pcc_thunk_t *)PCC_MALLOC(auxil, sizeof(pcc_thunk_t));\n" " thunk->type = PCC_THUNK_NODE;\n" " thunk->data.node.thunks = thunks;\n" " thunk->data.node.value = value;\n" " return thunk;\n" "}\n" "\n" "static void pcc_thunk__destroy(pcc_auxil_t auxil, pcc_thunk_t *thunk) {\n" " if (thunk == NULL) return;\n" " switch (thunk->type) {\n" " case PCC_THUNK_LEAF:\n" " PCC_FREE(auxil, thunk->data.leaf.capt0.string);\n" " pcc_capture_const_table__term(auxil, &thunk->data.leaf.capts);\n" " pcc_value_refer_table__term(auxil, &thunk->data.leaf.values);\n" " break;\n" " case PCC_THUNK_NODE:\n" " break;\n" " default: /* unknown */\n" " break;\n" " }\n" " PCC_FREE(auxil, thunk);\n" "}\n" "\n" "static void pcc_thunk_array__init(pcc_auxil_t auxil, pcc_thunk_array_t *array, int max) {\n" " array->len = 0;\n" " array->max = max;\n" " array->buf = (pcc_thunk_t **)PCC_MALLOC(auxil, (size_t)array->max * sizeof(pcc_thunk_t *));\n" "}\n" "\n" "static void pcc_thunk_array__add(pcc_auxil_t auxil, pcc_thunk_array_t *array, pcc_thunk_t *thunk) {\n" " if (array->max <= 0) array->max = 1;\n" " while (array->max <= array->len) array->max <<= 1;\n" " array->buf = (pcc_thunk_t **)PCC_REALLOC(auxil, array->buf, (size_t)array->max * sizeof(pcc_thunk_t *));\n" " array->buf[array->len++] = thunk;\n" "}\n" "\n" "static void pcc_thunk_array__revert(pcc_auxil_t auxil, pcc_thunk_array_t *array, int len) {\n" " if (array->len > len) {\n" " int i;\n" " for (i = array->len - 1; i >= len; i--) pcc_thunk__destroy(auxil, array->buf[i]);\n" " array->len = len;\n" " }\n" "}\n" "\n" "static void pcc_thunk_array__term(pcc_auxil_t auxil, pcc_thunk_array_t *array) {\n" " int i;\n" " for (i = array->len - 1; i >= 0; i--) pcc_thunk__destroy(auxil, array->buf[i]);\n" " PCC_FREE(auxil, array->buf);\n" "}\n" "\n" "static pcc_thunk_chunk_t *pcc_thunk_chunk__create(pcc_auxil_t auxil) {\n" " pcc_thunk_chunk_t *chunk = (pcc_thunk_chunk_t *)PCC_MALLOC(auxil, sizeof(pcc_thunk_chunk_t));\n" " pcc_value_table__init(auxil, &chunk->values, PCC_ARRAYSIZE);\n" " pcc_capture_table__init(auxil, &chunk->capts, PCC_ARRAYSIZE);\n" " pcc_thunk_array__init(auxil, &chunk->thunks, PCC_ARRAYSIZE);\n" " chunk->pos = 0;\n" " return chunk;\n" "}\n" "\n" "static void pcc_thunk_chunk__destroy(pcc_auxil_t auxil, pcc_thunk_chunk_t *chunk) {\n" " if (chunk == NULL) return;\n" " pcc_thunk_array__term(auxil, &chunk->thunks);\n" " pcc_capture_table__term(auxil, &chunk->capts);\n" " pcc_value_table__term(auxil, &chunk->values);\n" " PCC_FREE(auxil, chunk);\n" "}\n" "\n" "static void pcc_rule_set__init(pcc_auxil_t auxil, pcc_rule_set_t *set, int max) {\n" " set->len = 0;\n" " set->max = max;\n" " set->buf = (pcc_rule_t *)PCC_MALLOC(auxil, (size_t)set->max * sizeof(pcc_rule_t));\n" "}\n" "\n" "static int pcc_rule_set__index(pcc_auxil_t auxil, const pcc_rule_set_t *set, pcc_rule_t rule) {\n" " int i;\n" " for (i = 0; i < set->len; i++) {\n" " if (set->buf[i] == rule) return i;\n" " }\n" " return -1;\n" "}\n" "\n" "static pcc_bool_t pcc_rule_set__add(pcc_auxil_t auxil, pcc_rule_set_t *set, pcc_rule_t rule) {\n" " int i = pcc_rule_set__index(auxil, set, rule);\n" " if (i >= 0) return PCC_FALSE;\n" " if (set->max <= 0) set->max = 1;\n" " while (set->max <= set->len) set->max <<= 1;\n" " set->buf = (pcc_rule_t *)PCC_REALLOC(auxil, set->buf, (size_t)set->max * sizeof(pcc_rule_t));\n" " set->buf[set->len++] = rule;\n" " return PCC_TRUE;\n" "}\n" "\n" "static pcc_bool_t pcc_rule_set__remove(pcc_auxil_t auxil, pcc_rule_set_t *set, pcc_rule_t rule) {\n" " int i = pcc_rule_set__index(auxil, set, rule);\n" " if (i < 0) return PCC_FALSE;\n" " memmove(set->buf + i, set->buf + (i + 1), (size_t)(set->len - (i + 1)) * sizeof(pcc_rule_t));\n" " return PCC_TRUE;\n" "}\n" "\n" "static void pcc_rule_set__clear(pcc_auxil_t auxil, pcc_rule_set_t *set) {\n" " set->len = 0;\n" "}\n" "\n" "static void pcc_rule_set__copy(pcc_auxil_t auxil, pcc_rule_set_t *set, const pcc_rule_set_t *src) {\n" " int i;\n" " pcc_rule_set__clear(auxil, set);\n" " for (i = 0; i < src->len; i++) {\n" " pcc_rule_set__add(auxil, set, src->buf[i]);\n" " }\n" "}\n" "\n" "static void pcc_rule_set__term(pcc_auxil_t auxil, pcc_rule_set_t *set) {\n" " PCC_FREE(auxil, set->buf);\n" "}\n" "\n" "static pcc_lr_head_t *pcc_lr_head__create(pcc_auxil_t auxil, pcc_rule_t rule) {\n" " pcc_lr_head_t *head = (pcc_lr_head_t *)PCC_MALLOC(auxil, sizeof(pcc_lr_head_t));\n" " head->rule = rule;\n" " pcc_rule_set__init(auxil, &head->invol, PCC_ARRAYSIZE);\n" " pcc_rule_set__init(auxil, &head->eval, PCC_ARRAYSIZE);\n" " head->hold = NULL;\n" " return head;\n" "}\n" "\n" "static void pcc_lr_head__destroy(pcc_auxil_t auxil, pcc_lr_head_t *head) {\n" " if (head == NULL) return;\n" " pcc_lr_head__destroy(auxil, head->hold);\n" " pcc_rule_set__term(auxil, &head->eval);\n" " pcc_rule_set__term(auxil, &head->invol);\n" " PCC_FREE(auxil, head);\n" "}\n" "\n" "static void pcc_lr_entry__destroy(pcc_auxil_t auxil, pcc_lr_entry_t *lr);\n" "\n" "static pcc_lr_answer_t *pcc_lr_answer__create(pcc_auxil_t auxil, pcc_lr_answer_type_t type, int pos) {\n" " pcc_lr_answer_t *answer = (pcc_lr_answer_t *)PCC_MALLOC(auxil, sizeof(pcc_lr_answer_t));\n" " answer->type = type;\n" " answer->pos = pos;\n" " answer->hold = NULL;\n" " switch (answer->type) {\n" " case PCC_LR_ANSWER_LR:\n" " answer->data.lr = NULL;\n" " break;\n" " case PCC_LR_ANSWER_CHUNK:\n" " answer->data.chunk = NULL;\n" " break;\n" " default: /* unknown */\n" " PCC_FREE(auxil, answer);\n" " answer = NULL;\n" " }\n" " return answer;\n" "}\n" "\n" "static void pcc_lr_answer__set_chunk(pcc_auxil_t auxil, pcc_lr_answer_t *answer, pcc_thunk_chunk_t *chunk) {\n" " pcc_lr_answer_t *a = pcc_lr_answer__create(auxil, answer->type, answer->pos);\n" " switch (answer->type) {\n" " case PCC_LR_ANSWER_LR:\n" " a->data.lr = answer->data.lr;\n" " break;\n" " case PCC_LR_ANSWER_CHUNK:\n" " a->data.chunk = answer->data.chunk;\n" " break;\n" " default: /* unknown */\n" " break;\n" " }\n" " a->hold = answer->hold;\n" " answer->hold = a;\n" " answer->type = PCC_LR_ANSWER_CHUNK;\n" " answer->data.chunk = chunk;\n" "}\n" "\n" "static void pcc_lr_answer__destroy(pcc_auxil_t auxil, pcc_lr_answer_t *answer) {\n" " if (answer == NULL) return;\n" " pcc_lr_answer__destroy(auxil, answer->hold);\n" " switch (answer->type) {\n" " case PCC_LR_ANSWER_LR:\n" " pcc_lr_entry__destroy(auxil, answer->data.lr);\n" " break;\n" " case PCC_LR_ANSWER_CHUNK:\n" " pcc_thunk_chunk__destroy(auxil, answer->data.chunk);\n" " break;\n" " default: /* unknown */\n" " break;\n" " }\n" " PCC_FREE(auxil, answer);\n" "}\n" "\n" "static void pcc_lr_memo_map__init(pcc_auxil_t auxil, pcc_lr_memo_map_t *map, int max) {\n" " map->len = 0;\n" " map->max = max;\n" " map->buf = (pcc_lr_memo_t *)PCC_MALLOC(auxil, (size_t)map->max * sizeof(pcc_lr_memo_t));\n" "}\n" "\n" "static int pcc_lr_memo_map__index(pcc_auxil_t auxil, pcc_lr_memo_map_t *map, pcc_rule_t rule) {\n" " int i;\n" " for (i = 0; i < map->len; i++) {\n" " if (map->buf[i].rule == rule) return i;\n" " }\n" " return -1;\n" "}\n" "\n" "static void pcc_lr_memo_map__put(pcc_auxil_t auxil, pcc_lr_memo_map_t *map, pcc_rule_t rule, pcc_lr_answer_t *answer) {\n" " int i = pcc_lr_memo_map__index(auxil, map, rule);\n" " if (i >= 0) {\n" " pcc_lr_answer__destroy(auxil, map->buf[i].answer);\n" " map->buf[i].answer = answer;\n" " }\n" " else {\n" " if (map->max <= 0) map->max = 1;\n" " while (map->max <= map->len) map->max <<= 1;\n" " map->buf = (pcc_lr_memo_t *)PCC_REALLOC(auxil, map->buf, (size_t)map->max * sizeof(pcc_lr_memo_t));\n" " map->buf[map->len].rule = rule;\n" " map->buf[map->len].answer = answer;\n" " map->len++;\n" " }\n" "}\n" "\n" "static pcc_lr_answer_t *pcc_lr_memo_map__get(pcc_auxil_t auxil, pcc_lr_memo_map_t *map, pcc_rule_t rule) {\n" " int i = pcc_lr_memo_map__index(auxil, map, rule);\n" " return (i >= 0) ? map->buf[i].answer : NULL;\n" "}\n" "\n" "static void pcc_lr_memo_map__term(pcc_auxil_t auxil, pcc_lr_memo_map_t *map) {\n" " int i;\n" " for (i = map->len - 1; i >= 0; i--) pcc_lr_answer__destroy(auxil, map->buf[i].answer);\n" " PCC_FREE(auxil, map->buf);\n" "}\n" "\n" "static pcc_lr_table_entry_t *pcc_lr_table_entry__create(pcc_auxil_t auxil) {\n" " pcc_lr_table_entry_t *entry = (pcc_lr_table_entry_t *)PCC_MALLOC(auxil, sizeof(pcc_lr_table_entry_t));\n" " entry->head = NULL;\n" " pcc_lr_memo_map__init(auxil, &entry->memos, PCC_ARRAYSIZE);\n" " entry->hold_a = NULL;\n" " entry->hold_h = NULL;\n" " return entry;\n" "}\n" "\n" "static void pcc_lr_table_entry__destroy(pcc_auxil_t auxil, pcc_lr_table_entry_t *entry) {\n" " if (entry == NULL) return;\n" " pcc_lr_head__destroy(auxil, entry->hold_h);\n" " pcc_lr_answer__destroy(auxil, entry->hold_a);\n" " pcc_lr_memo_map__term(auxil, &entry->memos);\n" " PCC_FREE(auxil, entry);\n" "}\n" "\n" "static void pcc_lr_table__init(pcc_auxil_t auxil, pcc_lr_table_t *table, int max) {\n" " table->len = 0;\n" " table->max = max;\n" " table->buf = (pcc_lr_table_entry_t **)PCC_MALLOC(auxil, (size_t)table->max * sizeof(pcc_lr_table_entry_t *));\n" "}\n" "\n" "static void pcc_lr_table__resize(pcc_auxil_t auxil, pcc_lr_table_t *table, int len) {\n" " int i;\n" " for (i = table->len - 1; i >= len; i--) pcc_lr_table_entry__destroy(auxil, table->buf[i]);\n" " if (table->max < len) {\n" " if (table->max <= 0) table->max = 1;\n" " while (table->max < len) table->max <<= 1;\n" " table->buf = (pcc_lr_table_entry_t **)PCC_REALLOC(auxil, table->buf, (size_t)table->max * sizeof(pcc_lr_table_entry_t *));\n" " }\n" " for (i = table->len; i < len; i++) table->buf[i] = NULL;\n" " table->len = len;\n" "}\n" "\n" "static void pcc_lr_table__set_head(pcc_auxil_t auxil, pcc_lr_table_t *table, int index, pcc_lr_head_t *head) {\n" " if (index >= table->len) pcc_lr_table__resize(auxil, table, index + 1);\n" " if (table->buf[index] == NULL) table->buf[index] = pcc_lr_table_entry__create(auxil);\n" " table->buf[index]->head = head;\n" "}\n" "\n" "static void pcc_lr_table__hold_head(pcc_auxil_t auxil, pcc_lr_table_t *table, int index, pcc_lr_head_t *head) {\n" " if (index >= table->len) pcc_lr_table__resize(auxil, table, index + 1);\n" " if (table->buf[index] == NULL) table->buf[index] = pcc_lr_table_entry__create(auxil);\n" " head->hold = table->buf[index]->hold_h;\n" " table->buf[index]->hold_h = head;\n" "}\n" "\n" "static void pcc_lr_table__set_answer(pcc_auxil_t auxil, pcc_lr_table_t *table, int index, pcc_rule_t rule, pcc_lr_answer_t *answer) {\n" " if (index >= table->len) pcc_lr_table__resize(auxil, table, index + 1);\n" " if (table->buf[index] == NULL) table->buf[index] = pcc_lr_table_entry__create(auxil);\n" " pcc_lr_memo_map__put(auxil, &table->buf[index]->memos, rule, answer);\n" "}\n" "\n" "static void pcc_lr_table__hold_answer(pcc_auxil_t auxil, pcc_lr_table_t *table, int index, pcc_lr_answer_t *answer) {\n" " if (index >= table->len) pcc_lr_table__resize(auxil, table, index + 1);\n" " if (table->buf[index] == NULL) table->buf[index] = pcc_lr_table_entry__create(auxil);\n" " answer->hold = table->buf[index]->hold_a;\n" " table->buf[index]->hold_a = answer;\n" "}\n" "\n" "static pcc_lr_head_t *pcc_lr_table__get_head(pcc_auxil_t auxil, pcc_lr_table_t *table, int index) {\n" " if (index >= table->len || table->buf[index] == NULL) return NULL;\n" " return table->buf[index]->head;\n" "}\n" "\n" "static pcc_lr_answer_t *pcc_lr_table__get_answer(pcc_auxil_t auxil, pcc_lr_table_t *table, int index, pcc_rule_t rule) {\n" " if (index >= table->len || table->buf[index] == NULL) return NULL;\n" " return pcc_lr_memo_map__get(auxil, &table->buf[index]->memos, rule);\n" "}\n" "\n" "static void pcc_lr_table__shift(pcc_auxil_t auxil, pcc_lr_table_t *table, int count) {\n" " int i;\n" " if (count > table->len) count = table->len;\n" " for (i = 0; i < count; i++) pcc_lr_table_entry__destroy(auxil, table->buf[i]);\n" " memmove(table->buf, table->buf + count, (size_t)(table->len - count) * sizeof(pcc_lr_table_entry_t *));\n" " table->len -= count;\n" "}\n" "\n" "static void pcc_lr_table__term(pcc_auxil_t auxil, pcc_lr_table_t *table) {\n" " int i;\n" " for (i = table->len - 1; i >= 0; i--) pcc_lr_table_entry__destroy(auxil, table->buf[i]);\n" " PCC_FREE(auxil, table->buf);\n" "}\n" "\n" "static pcc_lr_entry_t *pcc_lr_entry__create(pcc_auxil_t auxil, pcc_rule_t rule) {\n" " pcc_lr_entry_t *lr = (pcc_lr_entry_t *)PCC_MALLOC(auxil, sizeof(pcc_lr_entry_t));\n" " lr->rule = rule;\n" " lr->seed = NULL;\n" " lr->head = NULL;\n" " return lr;\n" "}\n" "\n" "static void pcc_lr_entry__destroy(pcc_auxil_t auxil, pcc_lr_entry_t *lr) {\n" " PCC_FREE(auxil, lr);\n" "}\n" "\n" "static void pcc_lr_stack__init(pcc_auxil_t auxil, pcc_lr_stack_t *stack, int max) {\n" " stack->len = 0;\n" " stack->max = max;\n" " stack->buf = (pcc_lr_entry_t **)PCC_MALLOC(auxil, (size_t)stack->max * sizeof(pcc_lr_entry_t *));\n" "}\n" "\n" "static void pcc_lr_stack__push(pcc_auxil_t auxil, pcc_lr_stack_t *stack, pcc_lr_entry_t *lr) {\n" " if (stack->max <= 0) stack->max = 1;\n" " while (stack->max <= stack->len) stack->max <<= 1;\n" " stack->buf = (pcc_lr_entry_t **)PCC_REALLOC(auxil, stack->buf, (size_t)stack->max * sizeof(pcc_lr_entry_t *));\n" " stack->buf[stack->len++] = lr;\n" "}\n" "\n" "static pcc_lr_entry_t *pcc_lr_stack__pop(pcc_auxil_t auxil, pcc_lr_stack_t *stack) {\n" " return stack->buf[--stack->len];\n" "}\n" "\n" "static void pcc_lr_stack__term(pcc_auxil_t auxil, pcc_lr_stack_t *stack) {\n" " PCC_FREE(auxil, stack->buf);\n" "}\n" "\n", stream ); fprintf( stream, "static %s_context_t *pcc_context__create(pcc_auxil_t auxil) {\n" " %s_context_t *ctx = (%s_context_t *)PCC_MALLOC(auxil, sizeof(%s_context_t));\n", get_prefix(ctx), get_prefix(ctx), get_prefix(ctx), get_prefix(ctx) ); fputs( " ctx->pos = 0;\n" " pcc_char_array__init(auxil, &ctx->buffer, PCC_BUFFERSIZE);\n" " pcc_lr_table__init(auxil, &ctx->lrtable, PCC_BUFFERSIZE);\n" " pcc_lr_stack__init(auxil, &ctx->lrstack, PCC_ARRAYSIZE);\n" " ctx->auxil = auxil;\n" " return ctx;\n" "}\n" "\n", stream ); fprintf( stream, "static void pcc_context__destroy(%s_context_t *ctx) {\n", get_prefix(ctx) ); fputs( " if (ctx == NULL) return;\n" " pcc_lr_stack__term(ctx->auxil, &ctx->lrstack);\n" " pcc_lr_table__term(ctx->auxil, &ctx->lrtable);\n" " pcc_char_array__term(ctx->auxil, &ctx->buffer);\n" " PCC_FREE(ctx->auxil, ctx);\n" "}\n" "\n", stream ); fprintf( stream, "static int pcc_refill_buffer(%s_context_t *ctx, int num) {\n", get_prefix(ctx) ); fputs( " int n, c;\n" " n = ctx->buffer.len - ctx->pos;\n" " if (n >= num) return n;\n" " while (ctx->buffer.len < ctx->pos + num) {\n" " c = PCC_GETCHAR(ctx->auxil);\n" " if (c == EOF) break;\n" " pcc_char_array__add(ctx->auxil, &ctx->buffer, (char)c);\n" " }\n" " return ctx->buffer.len - ctx->pos;\n" "}\n" "\n", stream ); fprintf( stream, "static void pcc_commit_buffer(%s_context_t *ctx) {\n", get_prefix(ctx) ); fputs( " memmove(ctx->buffer.buf, ctx->buffer.buf + ctx->pos, ctx->buffer.len - ctx->pos);\n" " ctx->buffer.len -= ctx->pos;\n" " pcc_lr_table__shift(ctx->auxil, &ctx->lrtable, ctx->pos);\n" " ctx->pos = 0;\n" "}\n" "\n", stream ); fprintf( stream, "static const char *pcc_get_capture_string(%s_context_t *ctx, const pcc_capture_t *capt) {\n", get_prefix(ctx) ); fputs( " if (capt->string == NULL)\n" " ((pcc_capture_t *)capt)->string =\n" " pcc_strndup_e(ctx->auxil, ctx->buffer.buf + capt->range.start, (size_t)capt->range.end - (size_t)capt->range.start);\n" " return capt->string;\n" "}\n" "\n", stream ); fprintf( stream, "static pcc_bool_t pcc_apply_rule(%s_context_t *ctx, pcc_rule_t rule, pcc_thunk_array_t *thunks, pcc_value_t *value) {\n", get_prefix(ctx) ); fputs( " static pcc_value_t null;\n" " pcc_thunk_chunk_t *c = NULL;\n" " int p = ctx->pos;\n" " pcc_bool_t b = PCC_TRUE;\n" " pcc_lr_answer_t *a = pcc_lr_table__get_answer(ctx->auxil, &ctx->lrtable, p, rule);\n" " pcc_lr_head_t *h = pcc_lr_table__get_head(ctx->auxil, &ctx->lrtable, p);\n" " if (h != NULL) {\n" " if (a == NULL && rule != h->rule && pcc_rule_set__index(ctx->auxil, &h->invol, rule) < 0) {\n" " b = PCC_FALSE;\n" " c = NULL;\n" " }\n" " else if (pcc_rule_set__remove(ctx->auxil, &h->eval, rule)) {\n" " b = PCC_FALSE;\n" " c = rule(ctx);\n" " a = pcc_lr_answer__create(ctx->auxil, PCC_LR_ANSWER_CHUNK, ctx->pos);\n" " a->data.chunk = c;\n" " pcc_lr_table__hold_answer(ctx->auxil, &ctx->lrtable, p, a);\n" " }\n" " }\n" " if (b) {\n" " if (a != NULL) {\n" " ctx->pos = a->pos;\n" " switch (a->type) {\n" " case PCC_LR_ANSWER_LR:\n" " if (a->data.lr->head == NULL) {\n" " a->data.lr->head = pcc_lr_head__create(ctx->auxil, rule);\n" " pcc_lr_table__hold_head(ctx->auxil, &ctx->lrtable, p, a->data.lr->head);\n" " }\n" " {\n" " int i;\n" " for (i = ctx->lrstack.len - 1; i >= 0; i--) {\n" " if (ctx->lrstack.buf[i]->head == a->data.lr->head) break;\n" " ctx->lrstack.buf[i]->head = a->data.lr->head;\n" " pcc_rule_set__add(ctx->auxil, &a->data.lr->head->invol, ctx->lrstack.buf[i]->rule);\n" " }\n" " }\n" " c = a->data.lr->seed;\n" " break;\n" " case PCC_LR_ANSWER_CHUNK:\n" " c = a->data.chunk;\n" " break;\n" " default: /* unknown */\n" " break;\n" " }\n" " }\n" " else {\n" " pcc_lr_entry_t *e = pcc_lr_entry__create(ctx->auxil, rule);\n" " pcc_lr_stack__push(ctx->auxil, &ctx->lrstack, e);\n" " a = pcc_lr_answer__create(ctx->auxil, PCC_LR_ANSWER_LR, p);\n" " a->data.lr = e;\n" " pcc_lr_table__set_answer(ctx->auxil, &ctx->lrtable, p, rule, a);\n" " c = rule(ctx);\n" " pcc_lr_stack__pop(ctx->auxil, &ctx->lrstack);\n" " a->pos = ctx->pos;\n" " if (e->head == NULL) {\n" " pcc_lr_answer__set_chunk(ctx->auxil, a, c);\n" " }\n" " else {\n" " e->seed = c;\n" " h = a->data.lr->head;\n" " if (h->rule != rule) {\n" " c = a->data.lr->seed;\n" " a = pcc_lr_answer__create(ctx->auxil, PCC_LR_ANSWER_CHUNK, ctx->pos);\n" " a->data.chunk = c;\n" " pcc_lr_table__hold_answer(ctx->auxil, &ctx->lrtable, p, a);\n" " }\n" " else {\n" " pcc_lr_answer__set_chunk(ctx->auxil, a, a->data.lr->seed);\n" " if (a->data.chunk == NULL) {\n" " c = NULL;\n" " }\n" " else {\n" " pcc_lr_table__set_head(ctx->auxil, &ctx->lrtable, p, h);\n" " for (;;) {\n" " ctx->pos = p;\n" " pcc_rule_set__copy(ctx->auxil, &h->eval, &h->invol);\n" " c = rule(ctx);\n" " if (c == NULL || ctx->pos <= a->pos) break;\n" " pcc_lr_answer__set_chunk(ctx->auxil, a, c);\n" " a->pos = ctx->pos;\n" " }\n" " pcc_thunk_chunk__destroy(ctx->auxil, c);\n" " pcc_lr_table__set_head(ctx->auxil, &ctx->lrtable, p, NULL);\n" " ctx->pos = a->pos;\n" " c = a->data.chunk;\n" " }\n" " }\n" " }\n" " }\n" " }\n" " if (c == NULL) return PCC_FALSE;\n" " if (value == NULL) value = &null;\n" " memset(value, 0, sizeof(pcc_value_t)); /* in case */\n" " pcc_thunk_array__add(ctx->auxil, thunks, pcc_thunk__create_node(ctx->auxil, &c->thunks, value));\n" " return PCC_TRUE;\n" "}\n" "\n", stream ); fprintf( stream, "static void pcc_do_action(%s_context_t *ctx, const pcc_thunk_array_t *thunks, pcc_value_t *value) {\n", get_prefix(ctx) ); fputs( " int i;\n" " for (i = 0; i < thunks->len; i++) {\n" " pcc_thunk_t *thunk = thunks->buf[i];\n" " switch (thunk->type) {\n" " case PCC_THUNK_LEAF:\n" " thunk->data.leaf.action(ctx, thunk, value);\n" " break;\n" " case PCC_THUNK_NODE:\n" " pcc_do_action(ctx, thunk->data.node.thunks, thunk->data.node.value);\n" " break;\n" " default: /* unknown */\n" " break;\n" " }\n" " }\n" "}\n" "\n", stream ); { int i, j, k; for (i = 0; i < ctx->rules.len; i++) { const node_rule_t *r = &ctx->rules.buf[i]->data.rule; for (j = 0; j < r->codes.len; j++) { const char *s; int d; const node_const_array_t *v, *c; int test = 0; switch (r->codes.buf[j]->type) { case NODE_ACTION: s = r->codes.buf[j]->data.action.value; d = r->codes.buf[j]->data.action.index; v = &r->codes.buf[j]->data.action.vars; c = &r->codes.buf[j]->data.action.capts; break; case NODE_TEST: test = 1; s = r->codes.buf[j]->data.test.value; d = r->codes.buf[j]->data.test.index; v = &r->codes.buf[j]->data.test.vars; c = &r->codes.buf[j]->data.test.capts; break; case NODE_ERROR: s = r->codes.buf[j]->data.error.value; d = r->codes.buf[j]->data.error.index; v = &r->codes.buf[j]->data.error.vars; c = &r->codes.buf[j]->data.error.capts; break; default: print_error("Internal error [%d]\n", __LINE__); exit(-1); } fprintf( stream, "static %s pcc_action_%s_%d(%s_context_t *__pcc_ctx, pcc_thunk_t *__pcc_in, pcc_value_t *__pcc_out) {\n", test ? "int" : "void", r->name, d, get_prefix(ctx) ); fputs( "#define auxil (__pcc_ctx->auxil)\n" "#define __ (*__pcc_out)\n", stream ); for (k = 0; k < v->len; k++) { assert(v->buf[k]->type == NODE_REFERENCE); fprintf( stream, "#define %s (*__pcc_in->data.leaf.values.buf[%d])\n", v->buf[k]->data.reference.var, v->buf[k]->data.reference.index ); } fputs( "#define _0 pcc_get_capture_string(__pcc_ctx, &__pcc_in->data.leaf.capt0)\n" "#define _0s ((const)__pcc_in->data.leaf.capt0.range.start)\n" "#define _0e ((const)__pcc_in->data.leaf.capt0.range.end)\n", stream ); for (k = 0; k < c->len; k++) { assert(c->buf[k]->type == NODE_CAPTURE); fprintf( stream, "#define _%d pcc_get_capture_string(__pcc_ctx, __pcc_in->data.leaf.capts.buf[%d])\n", c->buf[k]->data.capture.index + 1, c->buf[k]->data.capture.index ); fprintf( stream, "#define _%ds __pcc_in->data.leaf.capts.buf[%d]->range.start\n", c->buf[k]->data.capture.index + 1, c->buf[k]->data.capture.index ); fprintf( stream, "#define _%de __pcc_in->data.leaf.capts.buf[%d]->range.end\n", c->buf[k]->data.capture.index + 1, c->buf[k]->data.capture.index ); } write_code_block(stream, s, (int)strlen(s), 4); for (k = c->len - 1; k >= 0; k--) { assert(c->buf[k]->type == NODE_CAPTURE); fprintf( stream, "#undef _%de\n", c->buf[k]->data.capture.index + 1 ); fprintf( stream, "#undef _%ds\n", c->buf[k]->data.capture.index + 1 ); fprintf( stream, "#undef _%d\n", c->buf[k]->data.capture.index + 1 ); } fputs( "#undef _0e\n" "#undef _0s\n" "#undef _0\n", stream ); for (k = v->len - 1; k >= 0; k--) { assert(v->buf[k]->type == NODE_REFERENCE); fprintf( stream, "#undef %s\n", v->buf[k]->data.reference.var ); } fputs( "#undef __\n" "#undef auxil\n", stream ); fputs( "}\n" "\n", stream ); } } } { int i; for (i = 0; i < ctx->rules.len; i++) { fprintf( stream, "static pcc_thunk_chunk_t *pcc_evaluate_rule_%s(%s_context_t *ctx);\n", ctx->rules.buf[i]->data.rule.name, get_prefix(ctx) ); } fputs( "\n", stream ); for (i = 0; i < ctx->rules.len; i++) { code_reach_t r; generate_t g; g.stream = stream; g.rule = ctx->rules.buf[i]; g.label = 0; fprintf( stream, "static pcc_thunk_chunk_t *pcc_evaluate_rule_%s(%s_context_t *ctx) {\n", ctx->rules.buf[i]->data.rule.name, get_prefix(ctx) ); fputs( " pcc_thunk_chunk_t *chunk = pcc_thunk_chunk__create(ctx->auxil);\n" " chunk->pos = ctx->pos;\n", stream ); fprintf( stream, " pcc_value_table__resize(ctx->auxil, &chunk->values, %d);\n", ctx->rules.buf[i]->data.rule.vars.len ); fprintf( stream, " pcc_capture_table__resize(ctx->auxil, &chunk->capts, %d);\n", ctx->rules.buf[i]->data.rule.capts.len ); r = generate_code(&g, ctx->rules.buf[i]->data.rule.expr, 0, 4, FALSE); fputs( " return chunk;\n", stream ); if (r != CODE_REACH__ALWAYS_SUCCEED) { fputs( "L0000:;\n" " pcc_thunk_chunk__destroy(ctx->auxil, chunk);\n" " return NULL;\n", stream ); } fputs( "}\n" "\n", stream ); } } fprintf( stream, "%s_context_t *%s_create(%s%sauxil) {\n", get_prefix(ctx), get_prefix(ctx), at, ap ? "" : " " ); fputs( " return pcc_context__create(auxil);\n" "}\n" "\n", stream ); fprintf( stream, "int %s_parse(%s_context_t *ctx, %s%s*ret) {\n", get_prefix(ctx), get_prefix(ctx), vt, vp ? "" : " " ); fputs( " pcc_thunk_array_t thunks;\n" " pcc_thunk_array__init(ctx->auxil, &thunks, PCC_ARRAYSIZE);\n", stream ); if (ctx->rules.len > 0) { fprintf( stream, " if (pcc_apply_rule(ctx, pcc_evaluate_rule_%s, &thunks, ret))\n", ctx->rules.buf[0]->data.rule.name ); fputs( " pcc_do_action(ctx, &thunks, ret);\n" " else\n" " PCC_ERROR(ctx->auxil);\n" " pcc_commit_buffer(ctx);\n", stream ); } fputs( " pcc_thunk_array__term(ctx->auxil, &thunks);\n" " return pcc_refill_buffer(ctx, 1) >= 1;\n" "}\n" "\n", stream ); fprintf( stream, "void %s_destroy(%s_context_t *ctx) {\n", get_prefix(ctx), get_prefix(ctx) ); fputs( " pcc_context__destroy(ctx);\n" "}\n", stream ); } { fputs( "#ifdef __cplusplus\n" "extern \"C\" {\n" "#endif\n" "\n", ctx->hfile ); fprintf( ctx->hfile, "typedef struct %s_context_tag %s_context_t;\n" "\n", get_prefix(ctx), get_prefix(ctx) ); fprintf( ctx->hfile, "%s_context_t *%s_create(%s%sauxil);\n", get_prefix(ctx), get_prefix(ctx), at, ap ? "" : " " ); fprintf( ctx->hfile, "int %s_parse(%s_context_t *ctx, %s%s*ret);\n", get_prefix(ctx), get_prefix(ctx), vt, vp ? "" : " " ); fprintf( ctx->hfile, "void %s_destroy(%s_context_t *ctx);\n", get_prefix(ctx), get_prefix(ctx) ); fputs( "\n" "#ifdef __cplusplus\n" "}\n" "#endif\n", ctx->hfile ); fprintf( ctx->hfile, "\n" "#endif /* PCC_INCLUDED__%s */\n", ctx->hid ); } { match_eol(ctx); if (!match_eof(ctx)) fputc('\n', stream); commit_buffer(ctx); while (refill_buffer(ctx, ctx->buffer.max) > 0) { int n = (ctx->buffer.buf[ctx->buffer.len - 1] == '\r') ? ctx->buffer.len - 1 : ctx->buffer.len; write_text(stream, ctx->buffer.buf, n); ctx->bufpos = n; commit_buffer(ctx); } } return (ctx->errnum == 0) ? TRUE : FALSE; } static void print_version(FILE *output) { fprintf(output, "%s version %s\n", g_cmdname, VERSION); fprintf(output, "Copyright (c) 2014 Arihiro Yoshida. All rights reserved.\n"); } static void print_usage(FILE *output) { fprintf(output, "Usage: %s [OPTIONS] [FILE]\n", g_cmdname); fprintf(output, "Generates a packrat parser for C.\n"); fprintf(output, "\n"); fprintf(output, " -o BASENAME specify a base name of output source and header files\n"); fprintf(output, " -d with debug information\n"); fprintf(output, " -h print this help message and exit\n"); fprintf(output, " -v print the version and exit\n"); } int main(int argc, char **argv) { const char *iname = NULL; const char *oname = NULL; bool_t debug = FALSE; #ifdef _MSC_VER #ifdef _DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); #endif #endif g_cmdname = extract_filename(argv[0]); { const char *fname = NULL; const char *opt_o = NULL; bool_t opt_d = FALSE; bool_t opt_h = FALSE; bool_t opt_v = FALSE; int i; for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { break; } else if (strcmp(argv[i] + 1, "-") == 0) { i++; break; } else if (argv[i][1] == 'o') { const char *o = (argv[i][2] != '\0') ? argv[i] + 2 : (++i < argc) ? argv[i] : NULL; if (o == NULL) { print_error("Output base name missing\n"); fprintf(stderr, "\n"); print_usage(stderr); exit(1); } if (opt_o != NULL) { print_error("Extra output base name '%s'\n", o); fprintf(stderr, "\n"); print_usage(stderr); exit(1); } opt_o = o; } else if (strcmp(argv[i] + 1, "d") == 0) { opt_d = TRUE; } else if (strcmp(argv[i] + 1, "h") == 0) { opt_h = TRUE; } else if (strcmp(argv[i] + 1, "v") == 0) { opt_v = TRUE; } else { print_error("Invalid option '%s'\n", argv[i]); fprintf(stderr, "\n"); print_usage(stderr); exit(1); } } switch (argc - i) { case 0: break; case 1: fname = argv[i]; break; default: print_error("Multiple input files\n"); fprintf(stderr, "\n"); print_usage(stderr); exit(1); } if (opt_h || opt_v) { if (opt_v) print_version(stdout); if (opt_v && opt_h) fprintf(stdout, "\n"); if (opt_h) print_usage(stdout); exit(0); } iname = (fname != NULL && fname[0] != '\0') ? fname : NULL; oname = (opt_o != NULL && opt_o[0] != '\0') ? opt_o : NULL; debug = opt_d; } { context_t *ctx = create_context(iname, oname, debug); int b = parse(ctx) && generate(ctx); destroy_context(ctx); if (!b) exit(10); } return 0; }
the_stack_data/40762312.c
#include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node *next; }; struct Node *head = NULL; void insert(int d) { if (head == NULL) { head = (struct Node *)malloc(sizeof(struct Node)); head->data = d; head->next = NULL; } else { struct Node *temp = (struct Node *)malloc(sizeof(struct Node)); temp->data = d; temp->next = head; head = temp; } } void reverse() { struct Node *cur = head, *next = NULL, *prev = NULL; while (cur != NULL) { next = cur->next; cur->next = prev; prev = cur; cur = next; } head = prev; } void display() { struct Node *temp = head; while (temp != NULL) { printf("%d ", temp->data); temp = temp->next; } } void main() { int n, d, i; printf("Enter number of nodes\n"); scanf("%d", &n); printf("Enter the values\n"); for (i = 0; i < n; i++) { scanf("%d", &d); insert(d); } printf("Linked list before reversing\n"); display(); reverse(); printf("\nLinked list after reversing\n"); display(); }
the_stack_data/1221353.c
/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to [email protected] before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. Ditto for AIX 3.2 and <stdlib.h>. */ #ifndef _NO_PROTO # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H # include <config.h> #endif #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ # ifndef const # define const # endif #endif #include <stdio.h> /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 # include <gnu-versions.h> # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include <stdlib.h> # include <unistd.h> #endif /* GNU C library. */ #ifdef VMS # include <unixlib.h> # if HAVE_STRING_H - 0 # include <string.h> # endif #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. */ # if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC # include <libintl.h> # ifndef _ # define _(msgid) gettext (msgid) # endif # else # define _(msgid) (msgid) # endif # if defined _LIBC && defined USE_IN_LIBIO # include <wchar.h> # endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char* optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char* nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char* posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ # include <string.h> # define my_index strchr #else # if HAVE_STRING_H || WIN32 || _WIN64 /* Pete Wilson mod 7/28/02 */ # include <string.h> # else # include <strings.h> # endif /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv extern char* getenv(); #endif static char* my_index(str, chr) const char* str; int chr; { while (*str) { if (*str == chr) return (char*)str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ # if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen(const char*); # endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ extern int __libc_argc; extern char** __libc_argv; /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_init.c */ extern char* __getopt_nonoption_flags; static int nonoption_flags_max_len; static int nonoption_flags_len; # endif # ifdef USE_NONOPTION_FLAGS # define SWAP_FLAGS(ch1, ch2) \ if (nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } # else # define SWAP_FLAGS(ch1, ch2) # endif #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined __STDC__ && __STDC__ static void exchange(char**); #endif static void exchange(argv) char** argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char* tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char* new_str = malloc(top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else { memset(__mempcpy(new_str, __getopt_nonoption_flags, nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS(bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS(bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined __STDC__ && __STDC__ static const char* _getopt_initialize(int, char* const*, const char*); #endif static const char* _getopt_initialize(argc, argv, optstring) int argc; char* const* argv; const char* optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS if (posixly_correct == NULL && argc == __libc_argc && argv == __libc_argv) { if (nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') nonoption_flags_max_len = -1; else { const char* orig_str = __getopt_nonoption_flags; int len = nonoption_flags_max_len = strlen(orig_str); if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char*)malloc(nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else memset(__mempcpy(__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } nonoption_flags_len = nonoption_flags_max_len; } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal(argc, argv, optstring, longopts, longind, long_only) int argc; char* const* argv; const char* optstring; const struct option* longopts; int* longind; int long_only; { int print_errors = opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize(argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && __getopt_nonoption_flags[optind] == '1')) #else # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT and LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange((char**)argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp(argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange((char**)argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index(optstring, argv[optind][1]))))) { char* nameend; const struct option* p; const struct option* pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((unsigned int)(nameend - nextchar) == (unsigned int)strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char* buf; __asprintf(&buf, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #else fprintf(stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); #endif } nextchar += strlen(nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char* buf; #endif if (argv[optind - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf(&buf, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf(stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf(&buf, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); #else fprintf(stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #endif } nextchar += strlen(nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char* buf; __asprintf(&buf, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #else fprintf(stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); #endif } nextchar += strlen(nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen(nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index(optstring, *nextchar) == NULL) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char* buf; #endif if (argv[optind][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf(&buf, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); #else fprintf(stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf(&buf, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); #else fprintf(stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #endif } nextchar = (char*)""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char* temp = my_index(optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char* buf; #endif if (posixly_correct) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf(&buf, _("%s: illegal option -- %c\n"), argv[0], c); #else fprintf(stderr, _("%s: illegal option -- %c\n"), argv[0], c); #endif } else { #if defined _LIBC && defined USE_IN_LIBIO __asprintf(&buf, _("%s: invalid option -- %c\n"), argv[0], c); #else fprintf(stderr, _("%s: invalid option -- %c\n"), argv[0], c); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #endif } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char* nameend; const struct option* p; const struct option* pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char* buf; __asprintf(&buf, _("%s: option requires an argument -- %c\n"), argv[0], c); if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #else fprintf(stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp(p->name, nextchar, nameend - nextchar)) { if ((unsigned int)(nameend - nextchar) == strlen(p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char* buf; __asprintf(&buf, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #else fprintf(stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); #endif } nextchar += strlen(nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char* buf; __asprintf(&buf, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #else fprintf(stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } nextchar += strlen(nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char* buf; __asprintf(&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #else fprintf(stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); #endif } nextchar += strlen(nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen(nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char* buf; __asprintf(&buf, _("%s: option requires an argument -- %c\n"), argv[0], c); if (_IO_fwide(stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else fputs(buf, stderr); free(buf); #else fprintf(stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt(argc, argv, optstring) int argc; char* const* argv; const char* optstring; { return _getopt_internal(argc, argv, optstring, (const struct option*)0, (int*)0, 0); } #endif /* Not ELIDE_CODE. */ /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ /* #define TEST */ /* Pete Wilson mod 7/28/02 */ #ifdef TEST #ifndef exit /* Pete Wilson mod 7/28/02 */ int exit(int); /* Pete Wilson mod 7/28/02 */ #endif /* Pete Wilson mod 7/28/02 */ int main(argc, argv) int argc; char** argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt(argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf("option %c\n", c); break; case 'a': printf("option a\n"); break; case 'b': printf("option b\n"); break; case 'c': printf("option c with value `%s'\n", optarg); break; case '?': break; default: printf("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf("non-option ARGV-elements: "); while (optind < argc) printf("%s ", argv[optind++]); printf("\n"); } exit(0); } #endif /* TEST */
the_stack_data/150142578.c
/* * Copyright (c) 2019-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include <stdio.h> #include <time.h> void swap_bad(int* array, int i, int j) { int tmp = array[i]; array[i] = array[j]; array[j] = tmp; } void alias_mod_bad(int array[], int i, int j) { int* a = array; a[j] = i; } void fresh_arr_ok(int size) { int arr[size]; for (int i = 0; i < size - 1; i++) { arr[i] = 0; } } void call_impure_with_local_ok(int size) { int arr[size]; alias_mod_bad(arr, 0, 9); } void time_bad() { time_t rawtime; struct tm* timeinfo; time(&rawtime); timeinfo = localtime(&rawtime); }
the_stack_data/28264026.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/socket.h> #define BUF_SIZE 30 void error_handling(char *message); int main(int argc, char *argv[]) { int recv_sock; struct sockaddr_in adr; int str_len; char buf[BUF_SIZE]; if(argc != 3){ printf("Usage : %s <PORT>\n", argv[0]); exit(1); } recv_sock = socket(PF_INET, SOCK_DGRAM,0); memset(&adr,0,sizeof(adr)); adr.sin_family = AF_INET; adr.sin_addr.s_addr = htonl(INADDR_ANY); adr.sin_port = htons(atoi(argv[1])); if(bind(recv_sock,(struct sockaddr*)&adr,sizeof(adr)) == -1) error_handling("bind() error"); while(1) { str_len = recvfrom(recv_sock,buf,BUF_SIZE-1,0,NULL,0); if(str_len < 0) break; buf[str_len]=0; fputs(buf,stdout); } close(recv_sock); return 0; } void error_handling(char *message) { fputs(message,stderr); fputc('\n',stderr); exit(1); }
the_stack_data/597589.c
#include <stdio.h> int main() { float n1, n2, n3; int x, y = 0; scanf(" %d", &x); while(y < x) { scanf(" %f %f %f", &n1, &n2, &n3); printf("%.1f\n",(n1 * 2 + n2 * 3 + n3 * 5)/10); y++; } return 0; }
the_stack_data/690922.c
/* Generated by CIL v. 1.7.3 */ /* print_CIL_Input is true */ #line 4 "/usr/local/ddv/models/con2/include/asm/posix_types.h" typedef unsigned long __kernel_ino_t; #line 5 "/usr/local/ddv/models/con2/include/asm/posix_types.h" typedef unsigned short __kernel_mode_t; #line 12 "/usr/local/ddv/models/con2/include/asm/posix_types.h" typedef unsigned int __kernel_size_t; #line 13 "/usr/local/ddv/models/con2/include/asm/posix_types.h" typedef int __kernel_ssize_t; #line 4 "/usr/local/ddv/models/con2/include/asm/types.h" typedef unsigned short umode_t; #line 13 "/usr/local/ddv/models/con2/include/asm/types.h" typedef unsigned int __u32; #line 9 "/usr/local/ddv/models/con2/include/linux/types.h" typedef __u32 __kernel_dev_t; #line 11 "/usr/local/ddv/models/con2/include/linux/types.h" typedef __kernel_dev_t dev_t; #line 12 "/usr/local/ddv/models/con2/include/linux/types.h" typedef __kernel_ino_t ino_t; #line 13 "/usr/local/ddv/models/con2/include/linux/types.h" typedef __kernel_mode_t mode_t; #line 30 "/usr/local/ddv/models/con2/include/linux/types.h" typedef long long loff_t; #line 38 "/usr/local/ddv/models/con2/include/linux/types.h" typedef __kernel_size_t size_t; #line 43 "/usr/local/ddv/models/con2/include/linux/types.h" typedef __kernel_ssize_t ssize_t; #line 44 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" struct __pthread_t_struct { int id ; }; #line 49 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" struct __pthread_attr_t_struct { int dummy ; }; #line 54 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" typedef struct __pthread_t_struct pthread_t; #line 55 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" typedef struct __pthread_attr_t_struct pthread_attr_t; #line 6 "/usr/local/ddv/models/con2/include/asm/atomic.h" typedef int atomic_t; #line 67 "/usr/local/ddv/models/con2/include/linux/gfp.h" struct page; #line 4 "/usr/local/ddv/models/con2/include/linux/dcache.h" struct inode; #line 4 "/usr/local/ddv/models/con2/include/linux/dcache.h" struct dentry { struct inode *d_inode ; }; #line 83 "/usr/local/ddv/models/con2/include/linux/fs.h" struct iovec; #line 84 struct poll_table_struct; #line 85 struct vm_area_struct; #line 90 "/usr/local/ddv/models/con2/include/linux/fs.h" struct address_space { struct inode *host ; }; #line 94 struct file_operations; #line 94 "/usr/local/ddv/models/con2/include/linux/fs.h" struct file { struct dentry *f_dentry ; struct file_operations *f_op ; atomic_t f_count ; unsigned int f_flags ; mode_t f_mode ; loff_t f_pos ; void *private_data ; struct address_space *f_mapping ; }; #line 105 struct gendisk; #line 105 "/usr/local/ddv/models/con2/include/linux/fs.h" struct block_device { struct inode *bd_inode ; struct gendisk *bd_disk ; struct block_device *bd_contains ; unsigned int bd_block_size ; }; #line 113 struct cdev; #line 113 "/usr/local/ddv/models/con2/include/linux/fs.h" struct inode { umode_t i_mode ; struct block_device *i_bdev ; dev_t i_rdev ; loff_t i_size ; struct cdev *i_cdev ; }; #line 122 "/usr/local/ddv/models/con2/include/linux/fs.h" struct __anonstruct_read_descriptor_t_4 { size_t written ; size_t count ; }; #line 122 "/usr/local/ddv/models/con2/include/linux/fs.h" typedef struct __anonstruct_read_descriptor_t_4 read_descriptor_t; #line 130 "/usr/local/ddv/models/con2/include/linux/fs.h" struct file_lock { int something ; }; #line 134 struct module; #line 134 "/usr/local/ddv/models/con2/include/linux/fs.h" struct file_operations { struct module *owner ; loff_t (*llseek)(struct file * , loff_t , int ) ; ssize_t (*read)(struct file * , char * , size_t , loff_t * ) ; ssize_t (*write)(struct file * , char const * , size_t , loff_t * ) ; int (*readdir)(struct file * , void * , int (*)(void * , char const * , int , loff_t , ino_t , unsigned int ) ) ; unsigned int (*poll)(struct file * , struct poll_table_struct * ) ; int (*ioctl)(struct inode * , struct file * , unsigned int , unsigned long ) ; long (*unlocked_ioctl)(struct file * , unsigned int , unsigned long ) ; long (*compat_ioctl)(struct file * , unsigned int , unsigned long ) ; int (*mmap)(struct file * , struct vm_area_struct * ) ; int (*open)(struct inode * , struct file * ) ; int (*flush)(struct file * ) ; int (*release)(struct inode * , struct file * ) ; int (*fsync)(struct file * , struct dentry * , int datasync ) ; int (*fasync)(int , struct file * , int ) ; int (*lock)(struct file * , int , struct file_lock * ) ; ssize_t (*readv)(struct file * , struct iovec const * , unsigned long , loff_t * ) ; ssize_t (*writev)(struct file * , struct iovec const * , unsigned long , loff_t * ) ; ssize_t (*sendfile)(struct file * , loff_t * , size_t , int (*)(read_descriptor_t * , struct page * , unsigned long , unsigned long ) , void * ) ; ssize_t (*sendpage)(struct file * , struct page * , int , size_t , loff_t * , int ) ; unsigned long (*get_unmapped_area)(struct file * , unsigned long , unsigned long , unsigned long , unsigned long ) ; int (*check_flags)(int ) ; int (*dir_notify)(struct file *filp , unsigned long arg ) ; int (*flock)(struct file * , int , struct file_lock * ) ; int (*open_exec)(struct inode * ) ; }; #line 4 "/usr/local/ddv/models/con2/include/linux/cdev.h" struct cdev { struct module *owner ; struct file_operations *ops ; dev_t dev ; unsigned int count ; }; #line 13 "/usr/local/ddv/models/con2/include/ddverify/cdev.h" struct ddv_cdev { struct cdev *cdevp ; struct file filp ; struct inode inode ; int open ; }; #line 30 "/usr/local/ddv/models/con2/include/asm/types.h" typedef unsigned long long u64; #line 91 "/usr/local/ddv/models/con2/include/linux/types.h" typedef unsigned long sector_t; #line 15 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" struct __pthread_t_struct___0 { int id ; }; #line 25 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" struct __pthread_mutex_t_struct { _Bool locked ; }; #line 30 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" struct __pthread_mutexattr_t_struct { int dummy ; }; #line 50 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" typedef struct __pthread_t_struct___0 pthread_t___0; #line 52 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" typedef struct __pthread_mutex_t_struct pthread_mutex_t; #line 53 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" typedef struct __pthread_mutexattr_t_struct pthread_mutexattr_t; #line 9 "/usr/local/ddv/models/con2/include/linux/list.h" struct list_head { struct list_head *next ; struct list_head *prev ; }; #line 4 "/usr/local/ddv/models/con2/include/linux/spinlock_types.h" struct __anonstruct_spinlock_t_9 { int init ; int locked ; }; #line 4 "/usr/local/ddv/models/con2/include/linux/spinlock_types.h" typedef struct __anonstruct_spinlock_t_9 spinlock_t; #line 4 "/usr/local/ddv/models/con2/include/linux/timer.h" struct timer_list { unsigned long expires ; void (*function)(unsigned long ) ; unsigned long data ; short __ddv_active ; short __ddv_init ; }; #line 82 "/usr/local/ddv/models/con2/include/linux/fs.h" struct hd_geometry; #line 168 "/usr/local/ddv/models/con2/include/linux/fs.h" struct block_device_operations { int (*open)(struct inode * , struct file * ) ; int (*release)(struct inode * , struct file * ) ; int (*ioctl)(struct inode * , struct file * , unsigned int , unsigned long ) ; long (*unlocked_ioctl)(struct file * , unsigned int , unsigned long ) ; long (*compat_ioctl)(struct file * , unsigned int , unsigned long ) ; int (*direct_access)(struct block_device * , sector_t , unsigned long * ) ; int (*media_changed)(struct gendisk * ) ; int (*revalidate_disk)(struct gendisk * ) ; int (*getgeo)(struct block_device * , struct hd_geometry * ) ; struct module *owner ; }; #line 18 "/usr/local/ddv/models/con2/include/linux/ioport.h" struct resource { char const *name ; unsigned long start ; unsigned long end ; unsigned long flags ; }; #line 24 "/usr/local/ddv/models/con2/include/linux/module.h" struct module { int something ; }; #line 8 "/usr/local/ddv/models/con2/include/linux/pm.h" struct pm_message { int event ; }; #line 8 "/usr/local/ddv/models/con2/include/linux/pm.h" typedef struct pm_message pm_message_t; #line 25 "/usr/local/ddv/models/con2/include/linux/device.h" struct device { void *driver_data ; void (*release)(struct device *dev ) ; }; #line 17 "/usr/local/ddv/models/con2/include/linux/genhd.h" struct request_queue; #line 17 "/usr/local/ddv/models/con2/include/linux/genhd.h" struct gendisk { int major ; int first_minor ; int minors ; char disk_name[32] ; struct block_device_operations *fops ; struct request_queue *queue ; void *private_data ; int flags ; struct device *driverfs_dev ; char devfs_name[64] ; }; #line 12 "/usr/local/ddv/models/con2/include/linux/workqueue.h" struct work_struct { unsigned long pending ; void (*func)(void * ) ; void *data ; int init ; }; #line 9 "/usr/local/ddv/models/con2/include/linux/mm_types.h" struct page { int something ; }; #line 4 "/usr/local/ddv/models/con2/include/asm/ptrace.h" struct pt_regs { int something ; }; #line 28 "/usr/local/ddv/models/con2/include/linux/interrupt.h" typedef int irqreturn_t; #line 34 "/usr/local/ddv/models/con2/include/linux/interrupt.h" struct tasklet_struct { atomic_t count ; void (*func)(unsigned long ) ; unsigned long data ; int init ; }; #line 11 "/usr/local/ddv/models/con2/include/linux/backing-dev.h" struct backing_dev_info { unsigned long ra_pages ; unsigned long state ; unsigned int capabilities ; }; #line 6 "/usr/local/ddv/models/con2/include/linux/bio.h" struct bio_vec { struct page *bv_page ; unsigned int bv_len ; unsigned int bv_offset ; }; #line 13 struct bio; #line 14 "/usr/local/ddv/models/con2/include/linux/bio.h" typedef int bio_end_io_t(struct bio * , unsigned int , int ); #line 17 "/usr/local/ddv/models/con2/include/linux/bio.h" struct bio { sector_t bi_sector ; struct bio *bi_next ; struct block_device *bi_bdev ; unsigned long bi_flags ; unsigned long bi_rw ; unsigned short bi_vcnt ; unsigned short bi_idx ; unsigned short bi_phys_segments ; unsigned int bi_size ; struct bio_vec *bi_io_vec ; bio_end_io_t *bi_end_io ; void *bi_private ; }; #line 4 "/usr/local/ddv/models/con2/include/linux/elevator.h" struct request; #line 23 "/usr/local/ddv/models/con2/include/linux/blkdev.h" typedef struct request_queue request_queue_t; #line 25 "/usr/local/ddv/models/con2/include/linux/blkdev.h" typedef void request_fn_proc(request_queue_t *q ); #line 26 "/usr/local/ddv/models/con2/include/linux/blkdev.h" typedef int make_request_fn(request_queue_t *q , struct bio *bio ); #line 27 "/usr/local/ddv/models/con2/include/linux/blkdev.h" typedef void unplug_fn(request_queue_t * ); #line 32 enum rq_cmd_type_bits { REQ_TYPE_FS = 1, REQ_TYPE_BLOCK_PC = 2, REQ_TYPE_SENSE = 3, REQ_TYPE_PM_SUSPEND = 4, REQ_TYPE_PM_RESUME = 5, REQ_TYPE_PM_SHUTDOWN = 6, REQ_TYPE_FLUSH = 7, REQ_TYPE_SPECIAL = 8, REQ_TYPE_LINUX_BLOCK = 9, REQ_TYPE_ATA_CMD = 10, REQ_TYPE_ATA_TASK = 11, REQ_TYPE_ATA_TASKFILE = 12, REQ_TYPE_ATA_PC = 13 } ; #line 54 "/usr/local/ddv/models/con2/include/linux/blkdev.h" struct request_queue { request_fn_proc *request_fn ; make_request_fn *make_request_fn ; unplug_fn *unplug_fn ; struct backing_dev_info backing_dev_info ; void *queuedata ; unsigned long queue_flags ; spinlock_t *queue_lock ; unsigned short hardsect_size ; int __ddv_genhd_no ; int __ddv_queue_alive ; }; #line 90 "/usr/local/ddv/models/con2/include/linux/blkdev.h" struct request { struct list_head queuelist ; struct list_head donelist ; request_queue_t *q ; unsigned long flags ; unsigned int cmd_flags ; enum rq_cmd_type_bits cmd_type ; struct bio *bio ; void *completion_data ; struct gendisk *rq_disk ; sector_t sector ; unsigned long nr_sectors ; unsigned int current_nr_sectors ; char *buffer ; int errors ; unsigned short nr_phys_segments ; unsigned char cmd[16] ; }; #line 15 "/usr/local/ddv/models/con2/include/ddverify/genhd.h" struct ddv_genhd { struct gendisk *gd ; struct inode inode ; struct file file ; struct request current_request ; int requests_open ; }; #line 6 "/usr/local/ddv/models/con2/include/linux/mod_devicetable.h" typedef unsigned long kernel_ulong_t; #line 10 "/usr/local/ddv/models/con2/include/linux/mod_devicetable.h" struct pci_device_id { __u32 vendor ; __u32 device ; __u32 subvendor ; __u32 subdevice ; __u32 class ; __u32 class_mask ; kernel_ulong_t driver_data ; }; #line 40 "/usr/local/ddv/models/con2/include/linux/pci.h" typedef int pci_power_t; #line 43 struct pci_bus; #line 43 "/usr/local/ddv/models/con2/include/linux/pci.h" struct pci_dev { struct pci_bus *bus ; unsigned int devfn ; unsigned short vendor ; unsigned short device ; u64 dma_mask ; struct device dev ; unsigned int irq ; struct resource resource[12] ; }; #line 62 "/usr/local/ddv/models/con2/include/linux/pci.h" struct pci_bus { unsigned char number ; }; #line 67 "/usr/local/ddv/models/con2/include/linux/pci.h" struct pci_driver { char *name ; struct pci_device_id const *id_table ; int (*probe)(struct pci_dev *dev , struct pci_device_id const *id ) ; void (*remove)(struct pci_dev *dev ) ; int (*suspend)(struct pci_dev *dev , pm_message_t state ) ; int (*resume)(struct pci_dev *dev ) ; int (*enable_wake)(struct pci_dev *dev , pci_power_t state , int enable ) ; void (*shutdown)(struct pci_dev *dev ) ; }; #line 6 "/usr/local/ddv/models/con2/include/ddverify/pci.h" struct ddv_pci_driver { struct pci_driver *pci_driver ; struct pci_dev pci_dev ; unsigned int no_pci_device_id ; int dev_initialized ; }; #line 9 "/usr/local/ddv/models/con2/include/ddverify/interrupt.h" struct registered_irq { irqreturn_t (*handler)(int , void * , struct pt_regs * ) ; void *dev_id ; }; #line 10 "/usr/local/ddv/models/con2/include/ddverify/tasklet.h" struct ddv_tasklet { struct tasklet_struct *tasklet ; unsigned short is_running ; }; #line 10 "/usr/local/ddv/models/con2/include/ddverify/timer.h" struct ddv_timer { struct timer_list *timer ; }; #line 88 "/usr/local/ddv/models/con2/include/linux/types.h" typedef unsigned int gfp_t; #line 7 "/usr/local/ddv/models/con2/include/asm/types.h" typedef unsigned char __u8; #line 16 "/usr/local/ddv/models/con2/include/linux/wait.h" struct __wait_queue_head { int number_process_waiting ; int wakeup ; int init ; }; #line 22 "/usr/local/ddv/models/con2/include/linux/wait.h" typedef struct __wait_queue_head wait_queue_head_t; #line 132 "aztcd.h" struct msf { unsigned char min ; unsigned char sec ; unsigned char frame ; }; #line 138 "aztcd.h" struct azt_Play_msf { struct msf start ; struct msf end ; }; #line 143 "aztcd.h" struct azt_DiskInfo { unsigned char first ; unsigned char next ; unsigned char last ; struct msf diskLength ; struct msf firstTrack ; unsigned char multi ; struct msf nextSession ; struct msf lastSession ; unsigned char xa ; unsigned char audio ; }; #line 156 "aztcd.h" struct azt_Toc { unsigned char ctrl_addr ; unsigned char track ; unsigned char pointIndex ; struct msf trackTime ; struct msf diskTime ; }; #line 153 "cdrom.h" struct cdrom_msf0 { __u8 minute ; __u8 second ; __u8 frame ; }; #line 161 "cdrom.h" union cdrom_addr { struct cdrom_msf0 msf ; int lba ; }; #line 168 "cdrom.h" struct cdrom_msf { __u8 cdmsf_min0 ; __u8 cdmsf_sec0 ; __u8 cdmsf_frame0 ; __u8 cdmsf_min1 ; __u8 cdmsf_sec1 ; __u8 cdmsf_frame1 ; }; #line 179 "cdrom.h" struct cdrom_ti { __u8 cdti_trk0 ; __u8 cdti_ind0 ; __u8 cdti_trk1 ; __u8 cdti_ind1 ; }; #line 188 "cdrom.h" struct cdrom_tochdr { __u8 cdth_trk0 ; __u8 cdth_trk1 ; }; #line 195 "cdrom.h" struct cdrom_volctrl { __u8 channel0 ; __u8 channel1 ; __u8 channel2 ; __u8 channel3 ; }; #line 204 "cdrom.h" struct cdrom_subchnl { __u8 cdsc_format ; __u8 cdsc_audiostatus ; __u8 cdsc_adr : 4 ; __u8 cdsc_ctrl : 4 ; __u8 cdsc_trk ; __u8 cdsc_ind ; union cdrom_addr cdsc_absaddr ; union cdrom_addr cdsc_reladdr ; }; #line 218 "cdrom.h" struct cdrom_tocentry { __u8 cdte_track ; __u8 cdte_adr : 4 ; __u8 cdte_ctrl : 4 ; __u8 cdte_format ; union cdrom_addr cdte_addr ; __u8 cdte_datamode ; }; #line 246 "cdrom.h" struct cdrom_multisession { union cdrom_addr addr ; __u8 xa_flag ; __u8 addr_format ; }; #line 248 "aztcd.c" enum azt_state_e { AZT_S_IDLE = 0, AZT_S_START = 1, AZT_S_MODE = 2, AZT_S_READ = 3, AZT_S_DATA = 4, AZT_S_STOP = 5, AZT_S_STOPPING = 6 } ; #line 256 enum azt_read_modes { AZT_MODE_0 = 0, AZT_MODE_1 = 1, AZT_MODE_2 = 2 } ; #line 34 "/usr/local/ddv/models/con2/include/linux/miscdevice.h" struct miscdevice { int minor ; char const *name ; struct file_operations *fops ; }; #line 7 "/usr/local/ddv/models/con2/include/linux/proc_fs.h" struct proc_dir_entry { int something ; }; #line 20 "/usr/local/ddv/models/con2/include/linux/mutex.h" struct mutex { int locked ; int init ; }; #line 4 "/usr/local/ddv/models/con2/include/asm/semaphore.h" struct semaphore { int init ; int locked ; }; #line 7 "/usr/local/ddv/models/con2/include/asm/posix_types.h" typedef long __kernel_off_t; #line 15 "/usr/local/ddv/models/con2/include/linux/types.h" typedef __kernel_off_t off_t; #line 6 "/usr/local/ddv/models/con2/include/asm/termbits.h" typedef unsigned char cc_t; #line 8 "/usr/local/ddv/models/con2/include/asm/termbits.h" typedef unsigned int tcflag_t; #line 11 "/usr/local/ddv/models/con2/include/asm/termbits.h" struct termios { tcflag_t c_iflag ; tcflag_t c_oflag ; tcflag_t c_cflag ; tcflag_t c_lflag ; cc_t c_line ; cc_t c_cc[19] ; }; #line 9 "/usr/local/ddv/models/con2/include/linux/tty_driver.h" struct tty_struct; #line 12 "/usr/local/ddv/models/con2/include/linux/tty_driver.h" struct tty_operations { int (*open)(struct tty_struct *tty , struct file *filp ) ; void (*close)(struct tty_struct *tty , struct file *filp ) ; int (*write)(struct tty_struct *tty , unsigned char const *buf , int count ) ; void (*put_char)(struct tty_struct *tty , unsigned char ch ) ; void (*flush_chars)(struct tty_struct *tty ) ; int (*write_room)(struct tty_struct *tty ) ; int (*chars_in_buffer)(struct tty_struct *tty ) ; int (*ioctl)(struct tty_struct *tty , struct file *file , unsigned int cmd , unsigned long arg ) ; void (*set_termios)(struct tty_struct *tty , struct termios *old ) ; void (*throttle)(struct tty_struct *tty ) ; void (*unthrottle)(struct tty_struct *tty ) ; void (*stop)(struct tty_struct *tty ) ; void (*start)(struct tty_struct *tty ) ; void (*hangup)(struct tty_struct *tty ) ; void (*break_ctl)(struct tty_struct *tty , int state ) ; void (*flush_buffer)(struct tty_struct *tty ) ; void (*set_ldisc)(struct tty_struct *tty ) ; void (*wait_until_sent)(struct tty_struct *tty , int timeout ) ; void (*send_xchar)(struct tty_struct *tty , char ch ) ; int (*read_proc)(char *page , char **start , off_t off , int count , int *eof , void *data ) ; int (*write_proc)(struct file *file , char const *buffer , unsigned long count , void *data ) ; int (*tiocmget)(struct tty_struct *tty , struct file *file ) ; int (*tiocmset)(struct tty_struct *tty , struct file *file , unsigned int set , unsigned int clear ) ; }; #line 43 "/usr/local/ddv/models/con2/include/linux/tty_driver.h" struct tty_driver { int magic ; struct cdev cdev ; struct module *owner ; char const *driver_name ; char const *name ; int name_base ; int major ; int minor_start ; int minor_num ; int num ; short type ; short subtype ; struct termios init_termios ; int flags ; int refcount ; struct proc_dir_entry *proc_entry ; int (*open)(struct tty_struct *tty , struct file *filp ) ; void (*close)(struct tty_struct *tty , struct file *filp ) ; int (*write)(struct tty_struct *tty , unsigned char const *buf , int count ) ; void (*put_char)(struct tty_struct *tty , unsigned char ch ) ; void (*flush_chars)(struct tty_struct *tty ) ; int (*write_room)(struct tty_struct *tty ) ; int (*chars_in_buffer)(struct tty_struct *tty ) ; int (*ioctl)(struct tty_struct *tty , struct file *file , unsigned int cmd , unsigned long arg ) ; void (*set_termios)(struct tty_struct *tty , struct termios *old ) ; void (*throttle)(struct tty_struct *tty ) ; void (*unthrottle)(struct tty_struct *tty ) ; void (*stop)(struct tty_struct *tty ) ; void (*start)(struct tty_struct *tty ) ; void (*hangup)(struct tty_struct *tty ) ; void (*break_ctl)(struct tty_struct *tty , int state ) ; void (*flush_buffer)(struct tty_struct *tty ) ; void (*set_ldisc)(struct tty_struct *tty ) ; void (*wait_until_sent)(struct tty_struct *tty , int timeout ) ; void (*send_xchar)(struct tty_struct *tty , char ch ) ; int (*read_proc)(char *page , char **start , off_t off , int count , int *eof , void *data ) ; int (*write_proc)(struct file *file , char const *buffer , unsigned long count , void *data ) ; int (*tiocmget)(struct tty_struct *tty , struct file *file ) ; int (*tiocmset)(struct tty_struct *tty , struct file *file , unsigned int set , unsigned int clear ) ; }; #line 113 "/usr/local/ddv/models/con2/include/linux/tty.h" struct tty_struct { int magic ; struct tty_driver *driver ; int index ; struct termios *termios ; struct termios *termios_locked ; char name[64] ; unsigned long flags ; int count ; unsigned char stopped : 1 ; unsigned char hw_stopped : 1 ; unsigned char flow_stopped : 1 ; unsigned char packet : 1 ; unsigned int receive_room ; wait_queue_head_t write_wait ; wait_queue_head_t read_wait ; void *disc_data ; void *driver_data ; unsigned char closing : 1 ; }; #line 7 "/usr/local/ddv/models/con2/include/ddverify/tty.h" struct ddv_tty_driver { struct tty_driver driver ; unsigned short allocated ; unsigned short registered ; }; #line 1 "cdev.o" #pragma merger("0","/tmp/cil-4nZTjFvY.i","") #line 11 "/usr/local/ddv/models/con2/include/ddverify/ddverify.h" int current_execution_context ; #line 42 "/usr/local/ddv/models/con2/include/ddverify/ddverify.h" int (*_ddv_module_init)(void) ; #line 43 "/usr/local/ddv/models/con2/include/ddverify/ddverify.h" void (*_ddv_module_exit)(void) ; #line 15 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" extern unsigned short nondet_ushort() ; #line 16 extern int nondet_int() ; #line 17 extern unsigned int nondet_uint() ; #line 19 extern unsigned long nondet_ulong() ; #line 20 extern char nondet_char() ; #line 23 extern loff_t nondet_loff_t() ; #line 24 extern size_t nondet_size_t() ; #line 57 extern pthread_t nondet_pthread_t() ; #line 59 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" __inline extern int pthread_create(pthread_t *__threadp , pthread_attr_t const *__attr , void *(*__start_routine)(void * ) , void *__arg ) { { #line 65 *__threadp = nondet_pthread_t(); #line 66 (*__start_routine)(__arg); #line 67 return (0); } } #line 7 "/usr/local/ddv/models/con2/include/linux/jiffies.h" unsigned long jiffies ; #line 12 "/usr/local/ddv/models/con2/include/ddverify/fixed_cdev.h" struct cdev fixed_cdev[10] ; #line 13 "/usr/local/ddv/models/con2/include/ddverify/fixed_cdev.h" int fixed_cdev_used = 0; #line 11 "/usr/local/ddv/models/con2/include/ddverify/cdev.h" short number_cdev_registered = (short)0; #line 22 "/usr/local/ddv/models/con2/include/ddverify/cdev.h" struct ddv_cdev cdev_registered[10] ; #line 24 void call_cdev_functions(void) ; #line 21 "/usr/local/ddv/models/con2/src/ddverify/cdev.c" extern int ( /* missing proto */ __CPROVER_assume)() ; #line 5 "/usr/local/ddv/models/con2/src/ddverify/cdev.c" void call_cdev_functions(void) { int cdev_no ; int result ; loff_t loff_t_value ; int int_value ; unsigned int uint_value ; unsigned long ulong_value ; char char_value ; size_t size_t_value ; unsigned short tmp ; int tmp___0 ; unsigned short tmp___1 ; { #line 16 if ((int )number_cdev_registered == 0) { #line 17 return; } #line 20 tmp = nondet_ushort(); #line 20 cdev_no = (int )tmp; #line 21 if (0 <= cdev_no) { #line 21 if (cdev_no < (int )number_cdev_registered) { #line 21 tmp___0 = 1; } else { #line 21 tmp___0 = 0; } } else { #line 21 tmp___0 = 0; } #line 21 __CPROVER_assume(tmp___0); #line 23 tmp___1 = nondet_ushort(); #line 23 switch ((int )tmp___1) { case 0: #line 25 if (((cdev_registered[cdev_no].cdevp)->ops)->llseek) { #line 26 loff_t_value = nondet_loff_t(); #line 27 int_value = nondet_int(); #line 29 (*(((cdev_registered[cdev_no].cdevp)->ops)->llseek))(& cdev_registered[cdev_no].filp, loff_t_value, int_value); } #line 33 break; case 1: #line 35 if (((cdev_registered[cdev_no].cdevp)->ops)->read) { #line 36 char_value = nondet_char(); #line 37 size_t_value = nondet_size_t(); #line 39 (*(((cdev_registered[cdev_no].cdevp)->ops)->read))(& cdev_registered[cdev_no].filp, & char_value, size_t_value, & loff_t_value); } #line 44 break; case 2: #line 47 break; case 3: #line 49 if (((cdev_registered[cdev_no].cdevp)->ops)->write) { #line 50 char_value = nondet_char(); #line 51 size_t_value = nondet_size_t(); #line 53 (*(((cdev_registered[cdev_no].cdevp)->ops)->write))(& cdev_registered[cdev_no].filp, (char const *)(& char_value), size_t_value, & loff_t_value); } #line 58 break; case 4: #line 61 break; case 5: #line 64 break; case 6: #line 67 break; case 7: #line 69 if (((cdev_registered[cdev_no].cdevp)->ops)->ioctl) { #line 70 uint_value = nondet_uint(); #line 71 ulong_value = nondet_ulong(); #line 73 (*(((cdev_registered[cdev_no].cdevp)->ops)->ioctl))(& cdev_registered[cdev_no].inode, & cdev_registered[cdev_no].filp, uint_value, ulong_value); } #line 79 break; case 8: #line 82 break; case 9: #line 85 break; case 10: #line 88 break; case 11: #line 90 if (((cdev_registered[cdev_no].cdevp)->ops)->open) { #line 90 if (! cdev_registered[cdev_no].open) { #line 92 result = (*(((cdev_registered[cdev_no].cdevp)->ops)->open))(& cdev_registered[cdev_no].inode, & cdev_registered[cdev_no].filp); #line 95 if (! result) { #line 96 cdev_registered[cdev_no].open = 1; } } } #line 99 break; case 12: #line 102 break; case 13: #line 104 if (((cdev_registered[cdev_no].cdevp)->ops)->release) { #line 104 if (cdev_registered[cdev_no].open) { #line 106 result = (*(((cdev_registered[cdev_no].cdevp)->ops)->release))(& cdev_registered[cdev_no].inode, & cdev_registered[cdev_no].filp); #line 109 if (! result) { #line 110 cdev_registered[cdev_no].open = 0; } } } #line 113 break; case 14: #line 116 break; case 15: #line 119 break; case 16: #line 122 break; case 17: #line 125 break; case 18: #line 128 break; case 19: #line 131 break; case 20: #line 134 break; case 21: #line 137 break; case 22: #line 140 break; case 23: #line 143 break; case 24: #line 146 break; case 25: #line 149 break; case 26: #line 152 break; default: #line 154 break; } #line 156 return; } } #line 1 "char_dev.o" #pragma merger("0","/tmp/cil-cqI_dtpc.i","") #line 8 "/usr/local/ddv/models/con2/include/linux/slab.h" extern void kfree(void const * ) ; #line 195 "/usr/local/ddv/models/con2/include/linux/fs.h" __inline int alloc_chrdev_region(dev_t *dev , unsigned int baseminor , unsigned int count , char const *name ) ; #line 196 __inline int register_chrdev_region(dev_t from , unsigned int count , char const *name ) ; #line 199 __inline int register_chrdev(unsigned int major , char const *name , struct file_operations *fops ) ; #line 200 __inline int unregister_chrdev(unsigned int major , char const *name ) ; #line 11 "/usr/local/ddv/models/con2/include/linux/cdev.h" __inline void cdev_init(struct cdev *cdev , struct file_operations *fops ) ; #line 13 __inline struct cdev *cdev_alloc(void) ; #line 17 __inline int cdev_add(struct cdev *p , dev_t dev , unsigned int count ) ; #line 19 __inline void cdev_del(struct cdev *p ) ; #line 9 "/usr/local/ddv/models/con2/src/linux/fs/char_dev.c" __inline int alloc_chrdev_region(dev_t *dev , unsigned int baseminor , unsigned int count , char const *name ) { int major ; int return_value ; int tmp ; int tmp___0 ; unsigned int tmp___1 ; { #line 12 tmp = nondet_int(); #line 12 return_value = tmp; #line 13 if (return_value == 0) { #line 13 tmp___0 = 1; } else #line 13 if (return_value == -1) { #line 13 tmp___0 = 1; } else { #line 13 tmp___0 = 0; } #line 13 __CPROVER_assume(tmp___0); #line 15 if (return_value == 0) { #line 16 tmp___1 = nondet_uint(); #line 16 major = (int )tmp___1; #line 17 *dev = (unsigned int )(major << 20) | baseminor; } #line 20 return (return_value); } } #line 23 "/usr/local/ddv/models/con2/src/linux/fs/char_dev.c" __inline int register_chrdev_region(dev_t from , unsigned int count , char const *name ) { int return_value ; int tmp ; int tmp___0 ; { #line 25 tmp = nondet_int(); #line 25 return_value = tmp; #line 26 if (return_value == 0) { #line 26 tmp___0 = 1; } else #line 26 if (return_value == -1) { #line 26 tmp___0 = 1; } else { #line 26 tmp___0 = 0; } #line 26 __CPROVER_assume(tmp___0); #line 28 return (return_value); } } #line 33 "/usr/local/ddv/models/con2/src/linux/fs/char_dev.c" __inline int register_chrdev(unsigned int major , char const *name , struct file_operations *fops ) { struct cdev *cdev ; int err ; int tmp ; { #line 39 tmp = register_chrdev_region((dev_t )0, 256U, name); #line 39 major = (unsigned int )tmp; #line 41 cdev = cdev_alloc(); #line 42 cdev->owner = fops->owner; #line 43 cdev->ops = fops; #line 45 err = cdev_add(cdev, major << 20, 256U); #line 47 if (err) { #line 48 kfree((void const *)cdev); #line 49 return (err); } #line 52 return ((int )major); } } #line 55 "/usr/local/ddv/models/con2/src/linux/fs/char_dev.c" __inline int unregister_chrdev(unsigned int major , char const *name ) { { #line 57 return (0); } } #line 60 "/usr/local/ddv/models/con2/src/linux/fs/char_dev.c" __inline struct cdev *cdev_alloc(void) { int tmp ; { #line 62 if (fixed_cdev_used < 10) { #line 63 tmp = fixed_cdev_used; #line 63 fixed_cdev_used ++; #line 63 return (& fixed_cdev[tmp]); } #line 65 return ((struct cdev *)0); } } #line 67 "/usr/local/ddv/models/con2/src/linux/fs/char_dev.c" __inline void cdev_init(struct cdev *cdev , struct file_operations *fops ) { { #line 69 cdev->ops = fops; #line 70 return; } } #line 72 "/usr/local/ddv/models/con2/src/linux/fs/char_dev.c" __inline int cdev_add(struct cdev *p , dev_t dev , unsigned int count ) { int return_value ; int tmp ; int tmp___0 ; { #line 74 p->dev = dev; #line 75 p->count = count; #line 77 tmp = nondet_int(); #line 77 return_value = tmp; #line 78 if (return_value == 0) { #line 78 tmp___0 = 1; } else #line 78 if (return_value == -1) { #line 78 tmp___0 = 1; } else { #line 78 tmp___0 = 0; } #line 78 __CPROVER_assume(tmp___0); #line 80 if (return_value == 0) { #line 81 if ((int )number_cdev_registered < 10) { #line 83 cdev_registered[number_cdev_registered].cdevp = p; #line 84 cdev_registered[number_cdev_registered].inode.i_rdev = dev; #line 85 cdev_registered[number_cdev_registered].inode.i_cdev = p; #line 86 cdev_registered[number_cdev_registered].open = 0; #line 88 number_cdev_registered = (short )((int )number_cdev_registered + 1); } else { #line 90 return (-1); } } #line 94 return (return_value); } } #line 97 "/usr/local/ddv/models/con2/src/linux/fs/char_dev.c" __inline void cdev_del(struct cdev *p ) { int i ; { #line 101 i = 0; #line 101 while (i < (int )number_cdev_registered) { #line 102 if ((unsigned long )cdev_registered[i].cdevp == (unsigned long )p) { #line 103 cdev_registered[i].cdevp = (struct cdev *)0; #line 105 return; } #line 101 i ++; } #line 108 return; } } #line 1 "ddverify.o" #pragma merger("0","/tmp/cil-F5CE61aT.i","") #line 45 "/usr/local/ddv/models/con2/include/ddverify/ddverify.h" int call_ddv(void) ; #line 39 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" extern void __CPROVER_atomic_begin() ; #line 40 extern void __CPROVER_atomic_end() ; #line 186 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" __inline extern int pthread_mutex_init(pthread_mutex_t *__mutex , pthread_mutexattr_t const *__mutex_attr ) { pthread_mutex_t i ; { #line 190 i.locked = (_Bool)0; #line 191 *__mutex = i; #line 192 return (0); } } #line 194 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" __inline extern int pthread_mutex_destroy(pthread_mutex_t *__mutex ) { { #line 196 return (0); } } #line 203 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" __inline extern int pthread_mutex_lock(pthread_mutex_t *__mutex ) { { #line 206 __CPROVER_atomic_begin(); #line 207 __CPROVER_assume(! __mutex->locked); #line 208 __mutex->locked = (_Bool)1; #line 209 __CPROVER_atomic_end(); #line 210 return (0); } } #line 216 extern int ( /* missing proto */ __CPROVER_assert)() ; #line 213 "/usr/local/ddv/models/con2/include/ddverify/pthread.h" __inline extern int pthread_mutex_unlock(pthread_mutex_t *__mutex ) { { #line 216 __CPROVER_assert((int )__mutex->locked, "pthread_mutex_unlock without lock"); #line 217 __mutex->locked = (_Bool)0; #line 218 return (0); } } #line 9 "/usr/local/ddv/models/con2/include/linux/spinlock.h" void spin_lock_init(spinlock_t *lock ) ; #line 12 "/usr/local/ddv/models/con2/include/ddverify/genhd.h" short number_genhd_registered = (short)0; #line 13 "/usr/local/ddv/models/con2/include/ddverify/genhd.h" short number_fixed_genhd_used = (short)0; #line 24 "/usr/local/ddv/models/con2/include/ddverify/genhd.h" struct gendisk fixed_gendisk[10] ; #line 25 "/usr/local/ddv/models/con2/include/ddverify/genhd.h" struct ddv_genhd genhd_registered[10] ; #line 14 "/usr/local/ddv/models/con2/include/ddverify/pci.h" struct ddv_pci_driver registered_pci_driver ; #line 19 extern void call_pci_functions() ; #line 14 "/usr/local/ddv/models/con2/include/ddverify/interrupt.h" struct registered_irq registered_irq[16] ; #line 16 void call_interrupt_handler(void) ; #line 8 "/usr/local/ddv/models/con2/include/ddverify/tasklet.h" short number_tasklet_registered = (short)0; #line 15 "/usr/local/ddv/models/con2/include/ddverify/tasklet.h" struct ddv_tasklet tasklet_registered[10] ; #line 17 void call_tasklet_functions(void) ; #line 8 "/usr/local/ddv/models/con2/include/ddverify/timer.h" short number_timer_registered = (short)0; #line 14 "/usr/local/ddv/models/con2/include/ddverify/timer.h" struct ddv_timer timer_registered[5] ; #line 16 extern void call_timer_functions() ; #line 8 "/usr/local/ddv/models/con2/include/ddverify/workqueue.h" struct work_struct *shared_workqueue[10] ; #line 10 void call_shared_workqueue_functions(void) ; #line 7 "/usr/local/ddv/models/con2/include/linux/smp_lock.h" spinlock_t kernel_lock ; #line 15 "/usr/local/ddv/models/con2/src/ddverify/ddverify.c" void init_kernel(void) { int i ; { #line 19 spin_lock_init(& kernel_lock); #line 21 i = 0; #line 21 while (i < 10) { #line 22 shared_workqueue[i] = (struct work_struct *)((void *)0); #line 21 i ++; } #line 25 i = 0; #line 25 while (i < 10) { #line 26 tasklet_registered[i].tasklet = (struct tasklet_struct *)((void *)0); #line 27 tasklet_registered[i].is_running = (unsigned short)0; #line 25 i ++; } #line 29 return; } } #line 31 "/usr/local/ddv/models/con2/src/ddverify/ddverify.c" static void *ddv_2(void *arg ) { unsigned short random ; { #line 35 while (1) { #line 36 random = nondet_ushort(); #line 38 switch ((int )random) { case 1: #line 40 current_execution_context = 2; #line 41 call_timer_functions(); #line 42 current_execution_context = 1; #line 43 break; case 2: #line 46 current_execution_context = 2; #line 47 call_interrupt_handler(); #line 48 current_execution_context = 1; #line 49 break; case 3: #line 52 current_execution_context = 1; #line 53 call_shared_workqueue_functions(); #line 54 current_execution_context = 1; #line 55 break; case 4: #line 58 current_execution_context = 2; #line 59 call_tasklet_functions(); #line 60 current_execution_context = 1; #line 61 break; case 5: #line 64 current_execution_context = 1; #line 65 call_pci_functions(); #line 66 current_execution_context = 1; #line 67 break; default: #line 70 break; } #line 35 if (! random) { #line 35 break; } } #line 73 return ((void *)0); } } #line 75 "/usr/local/ddv/models/con2/src/ddverify/ddverify.c" void ddv(void) { pthread_t___0 thread ; int tmp ; { #line 81 pthread_create((struct __pthread_t_struct *)(& thread), (struct __pthread_attr_t_struct const *)((void *)0), & ddv_2, (void *)0); #line 83 while (1) { #line 84 current_execution_context = 1; #line 86 call_cdev_functions(); #line 83 tmp = nondet_int(); #line 83 if (! tmp) { #line 83 break; } } #line 93 return; } } #line 95 "/usr/local/ddv/models/con2/src/ddverify/ddverify.c" int call_ddv(void) { int err ; { #line 99 current_execution_context = 1; #line 101 init_kernel(); #line 103 err = (*_ddv_module_init)(); #line 105 if (err) { #line 106 return (-1); } #line 110 ddv(); #line 112 current_execution_context = 1; #line 113 (*_ddv_module_exit)(); #line 115 return (0); } } #line 1 "genhd.o" #pragma merger("0","/tmp/cil-1qBbyimL.i","") #line 9 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" extern void *malloc(size_t size ) ; #line 207 "/usr/local/ddv/models/con2/include/linux/fs.h" int register_blkdev(unsigned int major , char const *name ) ; #line 208 int unregister_blkdev(unsigned int major , char const *name ) ; #line 33 "/usr/local/ddv/models/con2/include/linux/genhd.h" void add_disk(struct gendisk *disk ) ; #line 35 void del_gendisk(struct gendisk *gp ) ; #line 37 struct gendisk *alloc_disk(int minors ) ; #line 6 "/usr/local/ddv/models/con2/src/linux/block/genhd.c" int register_blkdev(unsigned int major , char const *name ) { int result ; int tmp ; { #line 8 tmp = nondet_int(); #line 8 result = tmp; #line 14 return (result); } } #line 17 "/usr/local/ddv/models/con2/src/linux/block/genhd.c" int unregister_blkdev(unsigned int major , char const *name ) { { #line 19 return (0); } } #line 22 "/usr/local/ddv/models/con2/src/linux/block/genhd.c" struct gendisk *alloc_disk(int minors ) { struct gendisk *gd ; { #line 26 if ((int )number_fixed_genhd_used < 10) { #line 27 gd = & fixed_gendisk[number_fixed_genhd_used]; #line 28 gd->minors = minors; #line 30 number_fixed_genhd_used = (short )((int )number_fixed_genhd_used + 1); #line 32 return (gd); } else { #line 34 return ((struct gendisk *)((void *)0)); } } } #line 38 "/usr/local/ddv/models/con2/src/linux/block/genhd.c" void add_disk(struct gendisk *disk ) { void *tmp ; { #line 40 if ((int )number_genhd_registered < 10) { #line 41 genhd_registered[number_genhd_registered].gd = disk; #line 42 tmp = malloc((size_t )sizeof(struct block_device )); #line 42 genhd_registered[number_genhd_registered].inode.i_bdev = (struct block_device *)tmp; #line 43 (genhd_registered[number_genhd_registered].inode.i_bdev)->bd_disk = disk; #line 45 number_genhd_registered = (short )((int )number_genhd_registered + 1); } #line 47 return; } } #line 49 "/usr/local/ddv/models/con2/src/linux/block/genhd.c" void del_gendisk(struct gendisk *gp ) { int i ; { #line 53 i = 0; #line 53 while (i < (int )number_genhd_registered) { #line 54 if ((unsigned long )genhd_registered[i].gd == (unsigned long )gp) { #line 55 genhd_registered[i].gd = (struct gendisk *)((void *)0); } #line 53 i ++; } #line 58 return; } } #line 1 "interrupt.o" #pragma merger("0","/tmp/cil-9p9TZsRo.i","") #line 10 "/usr/local/ddv/models/con2/src/ddverify/interrupt.c" void call_interrupt_handler(void) { unsigned short i ; struct pt_regs regs ; int tmp ; { #line 15 tmp = nondet_int(); #line 15 i = (unsigned short )tmp; #line 16 __CPROVER_assume((int )i < 16); #line 18 if (registered_irq[i].handler) { #line 19 (*(registered_irq[i].handler))((int )i, registered_irq[i].dev_id, & regs); } #line 22 return; } } #line 1 "ioctl.o" #pragma merger("0","/tmp/cil-5emvH0wa.i","") #line 1 "ll_rw_blk.o" #pragma merger("0","/tmp/cil-cHqPncNN.i","") #line 192 "/usr/local/ddv/models/con2/include/linux/blkdev.h" request_queue_t *blk_alloc_queue(gfp_t gfp_mask ) ; #line 194 request_queue_t *blk_init_queue(request_fn_proc *rfn , spinlock_t *lock ) ; #line 196 void blk_queue_make_request(request_queue_t *q , make_request_fn *mfn ) ; #line 198 void blk_queue_hardsect_size(request_queue_t *q , unsigned short size ) ; #line 200 void blk_cleanup_queue(request_queue_t *q ) ; #line 220 void end_request(struct request *req , int uptodate ) ; #line 6 "/usr/local/ddv/models/con2/include/ddverify/blkdev.h" request_queue_t fixed_request_queue[10] ; #line 8 "/usr/local/ddv/models/con2/include/ddverify/blkdev.h" int number_request_queue_used = 0; #line 7 "/usr/local/ddv/models/con2/src/linux/block/ll_rw_blk.c" request_queue_t *get_fixed_request_queue(void) { int tmp ; { #line 9 if (number_request_queue_used < 10) { #line 10 tmp = number_request_queue_used; #line 10 number_request_queue_used ++; #line 10 return (& fixed_request_queue[tmp]); } else { #line 12 return ((request_queue_t *)((void *)0)); } } } #line 16 "/usr/local/ddv/models/con2/src/linux/block/ll_rw_blk.c" request_queue_t *blk_init_queue(request_fn_proc *rfn , spinlock_t *lock ) { request_queue_t *queue ; int tmp ; { #line 20 tmp = nondet_int(); #line 20 if (tmp) { #line 21 queue = get_fixed_request_queue(); #line 23 queue->queue_lock = lock; #line 24 queue->request_fn = rfn; #line 25 queue->make_request_fn = (make_request_fn *)((void *)0); #line 26 queue->__ddv_queue_alive = 1; #line 28 return (queue); } else { #line 30 return ((request_queue_t *)((void *)0)); } } } #line 34 "/usr/local/ddv/models/con2/src/linux/block/ll_rw_blk.c" request_queue_t *blk_alloc_queue(gfp_t gfp_mask ) { request_queue_t *queue ; int tmp ; { #line 38 tmp = nondet_int(); #line 38 if (tmp) { #line 39 queue = get_fixed_request_queue(); #line 41 queue->request_fn = (request_fn_proc *)((void *)0); #line 42 queue->make_request_fn = (make_request_fn *)((void *)0); #line 43 queue->__ddv_queue_alive = 1; #line 45 return (queue); } else { #line 47 return ((request_queue_t *)((void *)0)); } } } #line 51 "/usr/local/ddv/models/con2/src/linux/block/ll_rw_blk.c" void blk_queue_make_request(request_queue_t *q , make_request_fn *mfn ) { { #line 53 q->make_request_fn = mfn; #line 54 return; } } #line 56 "/usr/local/ddv/models/con2/src/linux/block/ll_rw_blk.c" void end_request(struct request *req , int uptodate ) { int genhd_no ; { #line 58 genhd_no = ((req->rq_disk)->queue)->__ddv_genhd_no; #line 60 genhd_registered[genhd_no].requests_open = 0; #line 61 return; } } #line 64 "/usr/local/ddv/models/con2/src/linux/block/ll_rw_blk.c" void blk_queue_hardsect_size(request_queue_t *q , unsigned short size ) { { #line 66 q->hardsect_size = size; #line 67 return; } } #line 69 "/usr/local/ddv/models/con2/src/linux/block/ll_rw_blk.c" void blk_cleanup_queue(request_queue_t *q ) { { #line 71 q->__ddv_queue_alive = 0; #line 72 return; } } #line 1 "__main.o" #pragma merger("0","/tmp/cil-5FCHWV04.i","") #line 18 "/usr/local/ddv/models/con2/include/linux/compiler.h" extern void barrier(void) ; #line 28 "/usr/local/ddv/models/con2/include/linux/timer.h" void add_timer(struct timer_list *timer ) ; #line 29 int del_timer(struct timer_list *timer ) ; #line 71 "/usr/local/ddv/models/con2/include/linux/wait.h" void wake_up(wait_queue_head_t *q ) ; #line 88 void sleep_on(wait_queue_head_t *q ) ; #line 30 "/usr/local/ddv/models/con2/include/linux/string.h" extern void *memcpy(void * , void const * , __kernel_size_t ) ; #line 90 "/usr/local/ddv/models/con2/include/linux/ioport.h" struct resource *request_region(unsigned long start , unsigned long len , char const *name ) ; #line 92 void release_region(unsigned long start , unsigned long len ) ; #line 34 "/usr/local/ddv/models/con2/include/linux/kernel.h" extern int printk(char const *fmt , ...) ; #line 35 extern int sprintf(char *buf , char const *fmt , ...) ; #line 39 "/usr/local/ddv/models/con2/include/linux/genhd.h" extern void put_disk(struct gendisk *disk ) ; #line 51 "/usr/local/ddv/models/con2/include/asm/uaccess.h" unsigned long copy_to_user(void *to , void const *from , unsigned long n ) ; #line 53 unsigned long copy_from_user(void *to , void *from , unsigned long n ) ; #line 4 "/usr/local/ddv/models/con2/include/linux/elevator.h" extern struct request *elv_next_request(struct request_queue *q ) ; #line 14 "/usr/local/ddv/models/con2/include/asm/io.h" unsigned char inb(unsigned int port ) ; #line 15 void outb(unsigned char byte , unsigned int port ) ; #line 24 void outb_p(unsigned char byte , unsigned int port ) ; #line 32 extern unsigned int insb(unsigned int , void *addr , unsigned long count ) ; #line 228 "aztcd.c" struct request_queue *azt_queue ; #line 230 "aztcd.c" int current_valid(void) { struct request *tmp ; struct request *tmp___0 ; struct request *tmp___1 ; int tmp___2 ; { #line 232 tmp = elv_next_request(azt_queue); #line 232 if (tmp) { #line 232 tmp___0 = elv_next_request(azt_queue); #line 232 if ((unsigned long )(tmp___0->cmd) == (unsigned long )((unsigned char *)0)) { #line 232 tmp___1 = elv_next_request(azt_queue); #line 232 if (tmp___1->sector != 0xffffffffffffffffUL) { #line 232 tmp___2 = 1; } else { #line 232 tmp___2 = 0; } } else { #line 232 tmp___2 = 0; } } else { #line 232 tmp___2 = 0; } #line 232 return (tmp___2); } } #line 265 "aztcd.c" int aztPresent = 0; #line 267 "aztcd.c" int volatile azt_transfer_is_active = (int volatile )0; #line 269 "aztcd.c" char azt_buf[37632] ; #line 271 "aztcd.c" char buf[2352] ; #line 274 "aztcd.c" int volatile azt_buf_bn[16] ; #line 274 "aztcd.c" int volatile azt_next_bn ; #line 275 "aztcd.c" int volatile azt_buf_in ; #line 275 "aztcd.c" int volatile azt_buf_out = (int volatile )-1; #line 276 "aztcd.c" int volatile azt_error = (int volatile )0; #line 277 "aztcd.c" int azt_open_count = 0; #line 278 "aztcd.c" enum azt_state_e volatile azt_state = (enum azt_state_e volatile )0; #line 283 "aztcd.c" enum azt_read_modes volatile azt_read_mode = (enum azt_read_modes volatile )1; #line 285 "aztcd.c" int azt_mode = -1; #line 286 "aztcd.c" int volatile azt_read_count = (int volatile )1; #line 288 "aztcd.c" int aztcd = -1; #line 292 "aztcd.c" int azt_port_auto[16] = { 800, 768, 784, 816, 0}; #line 294 "aztcd.c" char azt_cont = (char)0; #line 295 "aztcd.c" char azt_init_end = (char)0; #line 296 "aztcd.c" char azt_auto_eject = (char)0; #line 298 "aztcd.c" int AztTimeout ; #line 298 "aztcd.c" int AztTries ; #line 299 "aztcd.c" wait_queue_head_t azt_waitq = {0, 0, 1}; #line 300 "aztcd.c" struct timer_list delay_timer = {0UL, (void (*)(unsigned long ))((void *)0), 0UL, (short)0, (short)1}; #line 302 "aztcd.c" struct azt_DiskInfo DiskInfo ; #line 303 "aztcd.c" struct azt_Toc Toc[104] ; #line 304 "aztcd.c" struct azt_Play_msf azt_Play ; #line 306 "aztcd.c" int aztAudioStatus = 21; #line 307 "aztcd.c" char aztDiskChanged = (char)1; #line 308 "aztcd.c" char aztTocUpToDate = (char)0; #line 310 "aztcd.c" unsigned char aztIndatum ; #line 311 "aztcd.c" unsigned long aztTimeOutCount ; #line 312 "aztcd.c" int aztCmd = 0; #line 314 "aztcd.c" spinlock_t aztSpin = {1, 0}; #line 321 void aztStatTimer(void) ; #line 324 int aztGetDiskInfo(void) ; #line 326 int aztGetMultiDiskInfo(void) ; #line 328 int aztGetToc(int multi ) ; #line 331 int check_aztcd_media_change(struct gendisk *disk ) ; #line 332 int aztcd_ioctl(struct inode *ip , struct file *fp , unsigned int cmd , unsigned long arg ) ; #line 334 int aztcd_open(struct inode *ip , struct file *fp ) ; #line 335 int aztcd_release(struct inode *inode , struct file *file ) ; #line 337 "aztcd.c" struct block_device_operations azt_fops = #line 337 {& aztcd_open, & aztcd_release, & aztcd_ioctl, (long (*)(struct file * , unsigned int , unsigned long ))0, (long (*)(struct file * , unsigned int , unsigned long ))0, (int (*)(struct block_device * , sector_t , unsigned long * ))0, & check_aztcd_media_change, (int (*)(struct gendisk * ))0, (int (*)(struct block_device * , struct hd_geometry * ))0, (struct module *)0}; #line 346 void azt_poll(void) ; #line 349 void azt_hsg2msf(long hsg , struct msf *msf ) ; #line 350 long azt_msf2hsg(struct msf *mp ) ; #line 351 void azt_bin2bcd(unsigned char *p ) ; #line 352 int azt_bcd2bin(unsigned char bcd ) ; #line 362 "aztcd.c" void op_ok(void) { { #line 364 aztTimeOutCount = 0UL; #line 365 while (1) { #line 366 aztIndatum = inb((unsigned int )aztcd); #line 367 aztTimeOutCount ++; #line 368 if (aztTimeOutCount >= 8000000UL) { #line 369 printk("aztcd: Error Wait OP_OK\n"); #line 370 break; } #line 365 if (! ((int )aztIndatum != 1)) { #line 365 break; } } #line 373 return; } } #line 394 "aztcd.c" void sten_low(void) { { #line 396 aztTimeOutCount = 0UL; #line 397 while (1) { #line 398 aztIndatum = inb((unsigned int )(aztcd + 1)); #line 399 aztTimeOutCount ++; #line 400 if (aztTimeOutCount >= 8000000UL) { #line 401 if (azt_init_end) { #line 402 printk("aztcd: Error Wait STEN_LOW commands:%x\n", aztCmd); } #line 405 break; } #line 397 if (! ((int )aztIndatum & 4)) { #line 397 break; } } #line 408 return; } } #line 412 "aztcd.c" void dten_low(void) { { #line 414 aztTimeOutCount = 0UL; #line 415 while (1) { #line 416 aztIndatum = inb((unsigned int )(aztcd + 1)); #line 417 aztTimeOutCount ++; #line 418 if (aztTimeOutCount >= 8000000UL) { #line 419 printk("aztcd: Error Wait DTEN_OK\n"); #line 420 break; } #line 415 if (! ((int )aztIndatum & 2)) { #line 415 break; } } #line 423 return; } } #line 430 "aztcd.c" void statusAzt(void) { { #line 432 AztTimeout = 400; #line 433 delay_timer.expires = jiffies + 1UL; #line 433 delay_timer.function = (void (*)(unsigned long ))((void *)(& aztStatTimer)); #line 433 add_timer(& delay_timer); #line 434 sleep_on(& azt_waitq); #line 435 if (AztTimeout <= 0) { #line 436 printk("aztcd: Error Wait STEN_LOW_WAIT command:%x\n", aztCmd); } #line 438 return; } } #line 441 "aztcd.c" void aztStatTimer(void) { unsigned char tmp ; { #line 443 tmp = inb((unsigned int )(aztcd + 1)); #line 443 if (! ((int )tmp & 4)) { #line 444 wake_up(& azt_waitq); #line 445 return; } #line 447 AztTimeout --; #line 448 if (AztTimeout <= 0) { #line 449 wake_up(& azt_waitq); #line 450 printk("aztcd: Error aztStatTimer: Timeout\n"); #line 451 return; } #line 453 delay_timer.expires = jiffies + 1UL; #line 453 delay_timer.function = (void (*)(unsigned long ))((void *)(& aztStatTimer)); #line 453 add_timer(& delay_timer); #line 454 return; } } #line 463 "aztcd.c" int aztSendCmd(int cmd ) { unsigned char data ; int retry ; unsigned char tmp ; unsigned char tmp___0 ; { #line 472 if (aztcd == 496) { #line 473 outb_p((unsigned char)160, (unsigned int )(aztcd + 6)); } else #line 472 if (aztcd == 368) { #line 473 outb_p((unsigned char)160, (unsigned int )(aztcd + 6)); } #line 473 outb_p((unsigned char)16, (unsigned int )(aztcd + 6)); #line 473 outb_p((unsigned char)0, (unsigned int )(aztcd + 7)); #line 473 outb_p((unsigned char)16, (unsigned int )(aztcd + 6)); #line 475 aztCmd = cmd; #line 476 outb((unsigned char)4, (unsigned int )(aztcd + 2)); #line 477 while (1) { #line 478 tmp = inb((unsigned int )(aztcd + 1)); #line 478 if ((int )tmp & 4) { #line 479 break; } #line 480 inb((unsigned int )aztcd); } #line 482 while (1) { #line 483 tmp___0 = inb((unsigned int )(aztcd + 1)); #line 483 if ((int )tmp___0 & 2) { #line 484 break; } #line 485 inb((unsigned int )aztcd); } #line 487 retry = 0; #line 487 while (retry < 3) { #line 488 outb((unsigned char )cmd, (unsigned int )aztcd); #line 489 sten_low(); #line 490 data = inb((unsigned int )aztcd); #line 491 if ((int )data == 1) { #line 492 return (0); } #line 494 if ((int )data == 5) { #line 495 sten_low(); #line 496 data = inb((unsigned int )aztcd); #line 497 printk("### Error 1 aztcd: aztSendCmd %x Error Code %x\n", cmd, (int )data); } #line 487 retry ++; } #line 502 if (retry >= 3) { #line 503 printk("### Error 2 aztcd: aztSendCmd %x \n", cmd); #line 504 azt_error = (int volatile )165; } #line 506 printk("aztcd: Warning: %s failed\n", "aztSendCmd"); #line 506 return (-1); } } #line 512 "aztcd.c" int sendAztCmd(int cmd , struct azt_Play_msf *params ) { unsigned char data ; int retry ; { #line 522 retry = 0; #line 522 while (retry < 3) { #line 523 aztSendCmd(cmd); #line 524 outb(params->start.min, (unsigned int )aztcd); #line 525 outb(params->start.sec, (unsigned int )aztcd); #line 526 outb(params->start.frame, (unsigned int )aztcd); #line 527 outb(params->end.min, (unsigned int )aztcd); #line 528 outb(params->end.sec, (unsigned int )aztcd); #line 529 outb(params->end.frame, (unsigned int )aztcd); #line 530 sten_low(); #line 531 data = inb((unsigned int )aztcd); #line 532 if ((int )data == 2) { #line 533 return (0); } #line 535 if ((int )data == 6) { #line 536 sten_low(); #line 537 data = inb((unsigned int )aztcd); #line 538 printk("### Error 1 aztcd: sendAztCmd %x Error Code %x\n", cmd, (int )data); } #line 522 retry ++; } #line 543 if (retry >= 3) { #line 544 printk("### Error 2 aztcd: sendAztCmd %x\n ", cmd); #line 545 azt_error = (int volatile )165; } #line 547 printk("aztcd: Warning: %s failed\n", "sendAztCmd"); #line 547 return (-1); } } #line 553 "aztcd.c" int aztSeek(struct azt_Play_msf *params ) { unsigned char data ; int retry ; { #line 562 retry = 0; #line 562 while (retry < 3) { #line 563 aztSendCmd(48); #line 564 outb(params->start.min, (unsigned int )aztcd); #line 565 outb(params->start.sec, (unsigned int )aztcd); #line 566 outb(params->start.frame, (unsigned int )aztcd); #line 567 sten_low(); #line 568 data = inb((unsigned int )aztcd); #line 569 if ((int )data == 2) { #line 570 return (0); } #line 572 if ((int )data == 6) { #line 573 sten_low(); #line 574 data = inb((unsigned int )aztcd); #line 575 printk("### Error 1 aztcd: aztSeek\n"); } #line 562 retry ++; } #line 578 if (retry >= 3) { #line 579 printk("### Error 2 aztcd: aztSeek\n "); #line 580 azt_error = (int volatile )165; } #line 582 printk("aztcd: Warning: %s failed\n", "aztSeek"); #line 582 return (-1); } } #line 589 "aztcd.c" int aztSetDiskType(int type ) { unsigned char data ; int retry ; { #line 597 retry = 0; #line 597 while (retry < 3) { #line 598 aztSendCmd(161); #line 599 outb((unsigned char )type, (unsigned int )aztcd); #line 600 sten_low(); #line 601 data = inb((unsigned int )aztcd); #line 602 if ((int )data == 2) { #line 603 azt_read_mode = (enum azt_read_modes volatile )type; #line 604 return (0); } #line 606 if ((int )data == 6) { #line 607 sten_low(); #line 608 data = inb((unsigned int )aztcd); #line 609 printk("### Error 1 aztcd: aztSetDiskType %x Error Code %x\n", type, (int )data); } #line 597 retry ++; } #line 614 if (retry >= 3) { #line 615 printk("### Error 2 aztcd: aztSetDiskType %x\n ", type); #line 616 azt_error = (int volatile )165; } #line 618 printk("aztcd: Warning: %s failed\n", "aztSetDiskType"); #line 618 return (-1); } } #line 625 "aztcd.c" int aztStatus(void) { int st ; unsigned char tmp ; { #line 632 sten_low(); #line 633 if (aztTimeOutCount < 8000000UL) { #line 634 tmp = inb((unsigned int )aztcd); #line 634 st = (int )tmp & 255; #line 635 return (st); } else { #line 637 printk("aztcd: Warning: %s failed\n", "aztStatus"); #line 637 return (-1); } } } #line 643 "aztcd.c" int getAztStatus(void) { int st ; int tmp ; unsigned char tmp___0 ; { #line 647 tmp = aztSendCmd(65); #line 647 if (tmp) { #line 648 printk("aztcd: Warning: %s failed\n", "getAztStatus 1"); #line 648 return (-1); } #line 649 sten_low(); #line 650 tmp___0 = inb((unsigned int )aztcd); #line 650 st = (int )tmp___0 & 255; #line 654 if (st == 255) { #line 655 printk("aztcd: AST_CMD_CHECK error or no status available\n"); #line 657 return (-1); } else #line 654 if (st & 128) { #line 655 printk("aztcd: AST_CMD_CHECK error or no status available\n"); #line 657 return (-1); } #line 660 if ((st & 28) != 4) { #line 660 if (aztAudioStatus == 17) { #line 663 aztAudioStatus = 19; } } #line 665 if (st & 2) { #line 666 aztDiskChanged = (char)1; #line 667 aztTocUpToDate = (char)0; #line 668 aztAudioStatus = 21; } else #line 665 if (st & 32) { #line 666 aztDiskChanged = (char)1; #line 667 aztTocUpToDate = (char)0; #line 668 aztAudioStatus = 21; } #line 670 return (st); } } #line 677 "aztcd.c" int aztPlay(struct azt_Play_msf *arg ) { int tmp ; { #line 679 tmp = sendAztCmd(144, arg); #line 679 if (tmp < 0) { #line 680 printk("aztcd: Warning: %s failed\n", "aztPlay"); #line 680 return (-1); } #line 681 return (0); } } #line 689 "aztcd.c" void aztCloseDoor(void) { { #line 691 aztSendCmd(97); #line 692 sten_low(); #line 693 return; } } #line 696 "aztcd.c" void aztLockDoor(void) { { #line 699 aztSendCmd(113); #line 700 sten_low(); #line 702 return; } } #line 705 "aztcd.c" void aztUnlockDoor(void) { { #line 708 aztSendCmd(114); #line 709 sten_low(); #line 711 return; } } #line 719 "aztcd.c" int aztGetValue(unsigned char *result ) { int s ; unsigned char tmp ; { #line 723 sten_low(); #line 724 if (aztTimeOutCount >= 8000000UL) { #line 725 printk("aztcd: aztGetValue timeout\n"); #line 726 return (-1); } #line 728 tmp = inb((unsigned int )aztcd); #line 728 s = (int )tmp & 255; #line 729 *result = (unsigned char )s; #line 730 return (0); } } #line 737 "aztcd.c" int aztGetQChannelInfo(struct azt_Toc *qp ) { unsigned char notUsed ; int st ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; int tmp___8 ; int tmp___9 ; int tmp___10 ; { #line 745 st = getAztStatus(); #line 745 if (st == -1) { #line 746 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 1"); #line 746 return (-1); } #line 747 tmp = aztSendCmd(80); #line 747 if (tmp) { #line 748 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 2"); #line 748 return (-1); } #line 750 tmp___0 = aztGetValue(& notUsed); #line 750 if (tmp___0) { #line 751 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 3"); #line 751 return (-1); } #line 752 if ((st & 28) == 12) { #line 753 qp->ctrl_addr = (unsigned char)0; #line 754 qp->track = (unsigned char)0; #line 755 qp->pointIndex = (unsigned char)0; #line 756 qp->trackTime.min = (unsigned char)0; #line 757 qp->trackTime.sec = (unsigned char)0; #line 758 qp->trackTime.frame = (unsigned char)0; #line 759 qp->diskTime.min = (unsigned char)0; #line 760 qp->diskTime.sec = (unsigned char)0; #line 761 qp->diskTime.frame = (unsigned char)0; #line 762 return (0); } else { #line 764 tmp___1 = aztGetValue(& qp->ctrl_addr); #line 764 if (tmp___1 < 0) { #line 765 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 765 return (-1); } #line 766 tmp___2 = aztGetValue(& qp->track); #line 766 if (tmp___2 < 0) { #line 767 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 767 return (-1); } #line 768 tmp___3 = aztGetValue(& qp->pointIndex); #line 768 if (tmp___3 < 0) { #line 769 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 769 return (-1); } #line 770 tmp___4 = aztGetValue(& qp->trackTime.min); #line 770 if (tmp___4 < 0) { #line 771 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 771 return (-1); } #line 772 tmp___5 = aztGetValue(& qp->trackTime.sec); #line 772 if (tmp___5 < 0) { #line 773 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 773 return (-1); } #line 774 tmp___6 = aztGetValue(& qp->trackTime.frame); #line 774 if (tmp___6 < 0) { #line 775 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 775 return (-1); } #line 776 tmp___7 = aztGetValue(& notUsed); #line 776 if (tmp___7 < 0) { #line 777 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 777 return (-1); } #line 778 tmp___8 = aztGetValue(& qp->diskTime.min); #line 778 if (tmp___8 < 0) { #line 779 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 779 return (-1); } #line 780 tmp___9 = aztGetValue(& qp->diskTime.sec); #line 780 if (tmp___9 < 0) { #line 781 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 781 return (-1); } #line 782 tmp___10 = aztGetValue(& qp->diskTime.frame); #line 782 if (tmp___10 < 0) { #line 783 printk("aztcd: Warning: %s failed\n", "aztGetQChannelInfo 4"); #line 783 return (-1); } } #line 788 return (0); } } #line 794 "aztcd.c" int aztUpdateToc(void) { int st ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; { #line 801 if (aztTocUpToDate) { #line 802 return (0); } #line 804 tmp = aztGetDiskInfo(); #line 804 if (tmp < 0) { #line 805 return (-5); } #line 807 tmp___0 = aztGetToc(0); #line 807 if (tmp___0 < 0) { #line 808 return (-5); } #line 814 if (! ((int )Toc[DiskInfo.first].ctrl_addr & 64)) { #line 815 DiskInfo.audio = (unsigned char)1; } else { #line 817 DiskInfo.audio = (unsigned char)0; } #line 820 if (! DiskInfo.audio) { #line 821 azt_Play.start.min = (unsigned char)0; #line 822 azt_Play.start.sec = (unsigned char)2; #line 823 azt_Play.start.frame = (unsigned char)0; #line 824 azt_Play.end.min = (unsigned char)0; #line 825 azt_Play.end.sec = (unsigned char)0; #line 826 azt_Play.end.frame = (unsigned char)1; #line 827 tmp___1 = sendAztCmd(32, & azt_Play); #line 827 if (tmp___1) { #line 828 return (-1); } #line 829 dten_low(); #line 830 st = 0; #line 830 while (st < 2048) { #line 831 inb((unsigned int )aztcd); #line 830 st ++; } } #line 833 tmp___2 = getAztStatus(); #line 833 DiskInfo.xa = (unsigned char )(tmp___2 & 1); #line 834 if (DiskInfo.xa) { #line 835 printk("aztcd: XA support experimental - mail results to [email protected]\n"); } #line 843 DiskInfo.multi = (unsigned char)0; #line 845 if (DiskInfo.xa) { #line 846 aztGetMultiDiskInfo(); } #line 849 if (DiskInfo.multi) { #line 850 DiskInfo.lastSession.min = Toc[DiskInfo.next].diskTime.min; #line 851 DiskInfo.lastSession.sec = Toc[DiskInfo.next].diskTime.sec; #line 852 DiskInfo.lastSession.frame = Toc[DiskInfo.next].diskTime.frame; #line 854 printk("aztcd: Multisession support experimental\n"); } else { #line 856 DiskInfo.lastSession.min = Toc[DiskInfo.first].diskTime.min; #line 858 DiskInfo.lastSession.sec = Toc[DiskInfo.first].diskTime.sec; #line 860 DiskInfo.lastSession.frame = Toc[DiskInfo.first].diskTime.frame; } #line 864 aztTocUpToDate = (char)1; #line 868 return (0); } } #line 875 "aztcd.c" int aztGetDiskInfo(void) { int limit ; unsigned char test ; struct azt_Toc qInfo ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; { #line 884 tmp = aztSendCmd(49); #line 884 if (tmp) { #line 885 printk("aztcd: Warning: %s failed\n", "aztGetDiskInfo 1"); #line 885 return (-1); } #line 886 statusAzt(); #line 887 test = (unsigned char)0; #line 888 limit = 300; #line 888 while (limit > 0) { #line 889 tmp___0 = aztGetQChannelInfo(& qInfo); #line 889 if (tmp___0 < 0) { #line 890 printk("aztcd: Warning: %s failed\n", "aztGetDiskInfo 2"); #line 890 return (-1); } #line 891 if ((int )qInfo.pointIndex == 160) { #line 892 DiskInfo.first = qInfo.diskTime.min; #line 893 tmp___1 = azt_bcd2bin(DiskInfo.first); #line 893 DiskInfo.first = (unsigned char )tmp___1; #line 894 test = (unsigned char )((int )test | 1); } #line 896 if ((int )qInfo.pointIndex == 161) { #line 897 DiskInfo.last = qInfo.diskTime.min; #line 898 tmp___2 = azt_bcd2bin(DiskInfo.last); #line 898 DiskInfo.last = (unsigned char )tmp___2; #line 899 test = (unsigned char )((int )test | 2); } #line 901 if ((int )qInfo.pointIndex == 162) { #line 902 DiskInfo.diskLength.min = qInfo.diskTime.min; #line 903 DiskInfo.diskLength.sec = qInfo.diskTime.sec; #line 904 DiskInfo.diskLength.frame = qInfo.diskTime.frame; #line 905 test = (unsigned char )((int )test | 4); } #line 907 if ((int )qInfo.pointIndex == (int )DiskInfo.first) { #line 907 if ((int )test & 1) { #line 908 DiskInfo.firstTrack.min = qInfo.diskTime.min; #line 909 DiskInfo.firstTrack.sec = qInfo.diskTime.sec; #line 910 DiskInfo.firstTrack.frame = qInfo.diskTime.frame; #line 911 test = (unsigned char )((int )test | 8); } } #line 913 if ((int )test == 15) { #line 914 break; } #line 888 limit --; } #line 925 if ((int )test != 15) { #line 926 return (-1); } #line 927 return (0); } } #line 934 "aztcd.c" int aztGetMultiDiskInfo(void) { int limit ; int k ; unsigned char test ; struct azt_Toc qInfo ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; { #line 936 k = 5; #line 944 while (1) { #line 945 azt_Play.start.min = Toc[(int )DiskInfo.last + 1].diskTime.min; #line 946 azt_Play.start.sec = Toc[(int )DiskInfo.last + 1].diskTime.sec; #line 947 azt_Play.start.frame = Toc[(int )DiskInfo.last + 1].diskTime.frame; #line 949 test = (unsigned char)0; #line 951 limit = 30; #line 951 while (limit > 0) { #line 952 tmp = aztSeek(& azt_Play); #line 952 if (tmp) { #line 953 printk("aztcd: Warning: %s failed\n", "aztGetMultiDiskInfo 1"); #line 953 return (-1); } #line 954 tmp___0 = aztGetQChannelInfo(& qInfo); #line 954 if (tmp___0 < 0) { #line 955 printk("aztcd: Warning: %s failed\n", "aztGetMultiDiskInfo 2"); #line 955 return (-1); } #line 956 if ((int )qInfo.track == 0) { #line 956 if (qInfo.pointIndex) { #line 957 break; } } #line 958 azt_Play.start.sec = (unsigned char )((int )azt_Play.start.sec + 10); #line 958 if ((int )azt_Play.start.sec > 59) { #line 959 azt_Play.start.sec = (unsigned char)0; #line 960 azt_Play.start.min = (unsigned char )((int )azt_Play.start.min + 1); } #line 951 limit --; } #line 963 if (! limit) { #line 964 break; } #line 970 limit = 300; #line 970 while (limit > 0) { #line 971 azt_Play.start.frame = (unsigned char )((int )azt_Play.start.frame + 1); #line 971 if ((int )azt_Play.start.frame > 74) { #line 972 azt_Play.start.frame = (unsigned char)0; #line 973 if ((int )azt_Play.start.sec > 59) { #line 974 azt_Play.start.sec = (unsigned char)0; #line 975 azt_Play.start.min = (unsigned char )((int )azt_Play.start.min + 1); } } #line 978 tmp___1 = aztSeek(& azt_Play); #line 978 if (tmp___1) { #line 979 printk("aztcd: Warning: %s failed\n", "aztGetMultiDiskInfo 3"); #line 979 return (-1); } #line 980 tmp___2 = aztGetQChannelInfo(& qInfo); #line 980 if (tmp___2 < 0) { #line 981 printk("aztcd: Warning: %s failed\n", "aztGetMultiDiskInfo 4"); #line 981 return (-1); } #line 982 if ((int )qInfo.pointIndex == 160) { #line 983 DiskInfo.next = qInfo.diskTime.min; #line 984 tmp___3 = azt_bcd2bin(DiskInfo.next); #line 984 DiskInfo.next = (unsigned char )tmp___3; #line 985 test = (unsigned char )((int )test | 1); } #line 987 if ((int )qInfo.pointIndex == 161) { #line 988 DiskInfo.last = qInfo.diskTime.min; #line 989 tmp___4 = azt_bcd2bin(DiskInfo.last); #line 989 DiskInfo.last = (unsigned char )tmp___4; #line 990 test = (unsigned char )((int )test | 2); } #line 992 if ((int )qInfo.pointIndex == 162) { #line 993 DiskInfo.diskLength.min = qInfo.diskTime.min; #line 995 DiskInfo.diskLength.sec = qInfo.diskTime.sec; #line 997 DiskInfo.diskLength.frame = qInfo.diskTime.frame; #line 999 test = (unsigned char )((int )test | 4); } #line 1001 if ((int )qInfo.pointIndex == (int )DiskInfo.next) { #line 1001 if ((int )test & 1) { #line 1002 DiskInfo.nextSession.min = qInfo.diskTime.min; #line 1004 DiskInfo.nextSession.sec = qInfo.diskTime.sec; #line 1006 DiskInfo.nextSession.frame = qInfo.diskTime.frame; #line 1008 test = (unsigned char )((int )test | 8); } } #line 1010 if ((int )test == 15) { #line 1011 break; } #line 970 limit --; } #line 1023 if ((int )test != 15) { #line 1024 break; } else { #line 1026 DiskInfo.multi = (unsigned char)1; } #line 1027 aztGetToc(1); #line 944 k --; #line 944 if (! k) { #line 944 break; } } #line 1033 return (0); } } #line 1040 "aztcd.c" int aztGetToc(int multi ) { int i ; int px ; int limit ; struct azt_Toc qInfo ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; { #line 1049 if (! multi) { #line 1050 i = 0; #line 1050 while (i < 104) { #line 1051 Toc[i].pointIndex = (unsigned char)0; #line 1050 i ++; } #line 1052 i = (int )DiskInfo.last + 3; } else { #line 1054 i = (int )DiskInfo.next; #line 1054 while (i < 104) { #line 1055 Toc[i].pointIndex = (unsigned char)0; #line 1054 i ++; } #line 1056 i = ((int )DiskInfo.last + 4) - (int )DiskInfo.next; } #line 1064 if (! multi) { #line 1065 azt_mode = 5; #line 1066 tmp = aztSendCmd(49); #line 1066 if (tmp) { #line 1067 printk("aztcd: Warning: %s failed\n", "aztGetToc 2"); #line 1067 return (-1); } #line 1068 statusAzt(); } #line 1070 limit = 300; #line 1070 while (limit > 0) { #line 1071 if (multi) { #line 1072 azt_Play.start.sec = (unsigned char )((int )azt_Play.start.sec + 1); #line 1072 if ((int )azt_Play.start.sec > 59) { #line 1073 azt_Play.start.sec = (unsigned char)0; #line 1074 azt_Play.start.min = (unsigned char )((int )azt_Play.start.min + 1); } #line 1076 tmp___0 = aztSeek(& azt_Play); #line 1076 if (tmp___0) { #line 1077 printk("aztcd: Warning: %s failed\n", "aztGetToc 3"); #line 1077 return (-1); } } #line 1079 tmp___1 = aztGetQChannelInfo(& qInfo); #line 1079 if (tmp___1 < 0) { #line 1080 break; } #line 1082 px = azt_bcd2bin(qInfo.pointIndex); #line 1084 if (px > 0) { #line 1084 if (px < 104) { #line 1084 if ((int )qInfo.track == 0) { #line 1085 if ((int )Toc[px].pointIndex == 0) { #line 1086 Toc[px] = qInfo; #line 1087 i --; } } } } #line 1090 if (i <= 0) { #line 1091 break; } #line 1070 limit --; } #line 1094 Toc[(int )DiskInfo.last + 1].diskTime = DiskInfo.diskLength; #line 1095 Toc[DiskInfo.last].trackTime = DiskInfo.diskLength; #line 1115 if (limit > 0) { #line 1115 tmp___2 = 0; } else { #line 1115 tmp___2 = -1; } #line 1115 return (tmp___2); } } #line 1145 "aztcd.c" int check_aztcd_media_change(struct gendisk *disk ) { { #line 1147 if (aztDiskChanged) { #line 1148 aztDiskChanged = (char)0; #line 1149 return (1); } else { #line 1151 return (0); } } } #line 1157 "aztcd.c" int aztcd_ioctl(struct inode *ip , struct file *fp , unsigned int cmd , unsigned long arg ) { int i ; struct azt_Toc qInfo ; struct cdrom_ti ti ; struct cdrom_tochdr tocHdr ; struct cdrom_msf msf ; struct cdrom_tocentry entry ; struct azt_Toc *tocPtr ; struct cdrom_subchnl subchnl ; struct cdrom_volctrl volctrl ; void *argp ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; struct cdrom_multisession ms ; unsigned long tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; long tmp___8 ; unsigned long tmp___9 ; unsigned long tmp___10 ; unsigned long tmp___11 ; unsigned long tmp___12 ; unsigned long tmp___13 ; long tmp___14 ; int tmp___15 ; int tmp___16 ; int tmp___17 ; unsigned long tmp___18 ; unsigned long tmp___19 ; int tmp___20 ; int tmp___21 ; int tmp___22 ; long tmp___23 ; long tmp___24 ; int tmp___25 ; int tmp___26 ; int tmp___27 ; int tmp___28 ; int tmp___29 ; int tmp___30 ; unsigned long tmp___31 ; unsigned long tmp___32 ; int tmp___33 ; int tmp___34 ; unsigned char tmp___35 ; unsigned long tmp___36 ; int tmp___37 ; unsigned long tmp___38 ; int tmp___39 ; unsigned long tmp___40 ; unsigned long tmp___41 ; int tmp___42 ; int tmp___43 ; int tmp___44 ; { #line 1169 argp = (void *)arg; #line 1176 if (! ip) { #line 1177 printk("aztcd: Warning: %s failed\n", "aztcd_ioctl 1"); #line 1177 return (-22); } #line 1178 tmp = getAztStatus(); #line 1178 if (tmp < 0) { #line 1179 printk("aztcd: Warning: %s failed\n", "aztcd_ioctl 2"); #line 1179 return (-5); } #line 1180 if (! aztTocUpToDate) { #line 1180 goto _L; } else #line 1180 if (aztDiskChanged) { _L: /* CIL Label */ #line 1181 i = aztUpdateToc(); #line 1181 if (i < 0) { #line 1182 printk("aztcd: Warning: %s failed\n", "aztcd_ioctl 3"); #line 1182 return (i); } } #line 1185 switch (cmd) { case 21256U: #line 1189 tmp___0 = aztSendCmd(97); #line 1189 if (tmp___0) { #line 1190 printk("aztcd: Warning: %s failed\n", "aztcd_ioctl 4"); #line 1190 return (-1); } #line 1191 statusAzt(); #line 1193 break; case 21255U: #line 1195 tmp___1 = aztSendCmd(129); #line 1195 if (tmp___1) { #line 1196 printk("aztcd: Warning: %s failed\n", "aztcd_ioctl 5"); #line 1196 return (-1); } #line 1197 statusAzt(); #line 1199 aztAudioStatus = 21; #line 1200 break; case 21249U: #line 1202 if (aztAudioStatus != 17) { #line 1203 return (-22); } #line 1205 tmp___2 = aztGetQChannelInfo(& qInfo); #line 1205 if (tmp___2 < 0) { #line 1206 aztAudioStatus = 21; #line 1207 printk("aztcd: Warning: %s failed\n", "aztcd_ioctl 7"); #line 1207 return (0); } #line 1209 azt_Play.start = qInfo.diskTime; #line 1211 tmp___3 = aztSendCmd(128); #line 1211 if (tmp___3) { #line 1212 printk("aztcd: Warning: %s failed\n", "aztcd_ioctl 8"); #line 1212 return (-1); } #line 1213 statusAzt(); #line 1214 aztAudioStatus = 18; #line 1215 break; case 21250U: #line 1217 if (aztAudioStatus != 18) { #line 1218 return (-22); } #line 1220 i = aztPlay(& azt_Play); #line 1221 if (i < 0) { #line 1222 aztAudioStatus = 20; #line 1223 return (-5); } #line 1225 aztAudioStatus = 17; #line 1226 break; case 21264U: #line 1233 tmp___4 = copy_from_user((void *)(& ms), argp, sizeof(struct cdrom_multisession )); #line 1233 if (tmp___4) { #line 1235 return (-14); } #line 1236 if ((int )ms.addr_format == 2) { #line 1237 tmp___5 = azt_bcd2bin(DiskInfo.lastSession.min); #line 1237 ms.addr.msf.minute = (__u8 )tmp___5; #line 1239 tmp___6 = azt_bcd2bin(DiskInfo.lastSession.sec); #line 1239 ms.addr.msf.second = (__u8 )tmp___6; #line 1241 tmp___7 = azt_bcd2bin(DiskInfo.lastSession.frame); #line 1241 ms.addr.msf.frame = (__u8 )tmp___7; } else #line 1244 if ((int )ms.addr_format == 1) { #line 1245 tmp___8 = azt_msf2hsg(& DiskInfo.lastSession); #line 1245 ms.addr.lba = (int )tmp___8; } else { #line 1248 return (-22); } #line 1249 ms.xa_flag = DiskInfo.xa; #line 1250 tmp___9 = copy_to_user(argp, (void const *)(& ms), sizeof(struct cdrom_multisession )); #line 1250 if (tmp___9) { #line 1252 return (-14); } #line 1270 return (0); case 21252U: #line 1273 tmp___10 = copy_from_user((void *)(& ti), argp, sizeof(ti)); #line 1273 if (tmp___10) { #line 1274 return (-14); } #line 1275 if ((int )ti.cdti_trk0 < (int )DiskInfo.first) { #line 1278 return (-22); } else #line 1275 if ((int )ti.cdti_trk0 > (int )DiskInfo.last) { #line 1278 return (-22); } else #line 1275 if ((int )ti.cdti_trk1 < (int )ti.cdti_trk0) { #line 1278 return (-22); } #line 1280 if ((int )ti.cdti_trk1 > (int )DiskInfo.last) { #line 1281 ti.cdti_trk1 = DiskInfo.last; } #line 1282 azt_Play.start = Toc[ti.cdti_trk0].diskTime; #line 1283 azt_Play.end = Toc[(int )ti.cdti_trk1 + 1].diskTime; #line 1290 i = aztPlay(& azt_Play); #line 1291 if (i < 0) { #line 1292 aztAudioStatus = 20; #line 1293 return (-5); } #line 1295 aztAudioStatus = 17; #line 1296 break; case 21251U: #line 1304 tmp___11 = copy_from_user((void *)(& msf), argp, sizeof(msf)); #line 1304 if (tmp___11) { #line 1305 return (-14); } #line 1307 azt_bin2bcd(& msf.cdmsf_min0); #line 1308 azt_bin2bcd(& msf.cdmsf_sec0); #line 1309 azt_bin2bcd(& msf.cdmsf_frame0); #line 1310 azt_bin2bcd(& msf.cdmsf_min1); #line 1311 azt_bin2bcd(& msf.cdmsf_sec1); #line 1312 azt_bin2bcd(& msf.cdmsf_frame1); #line 1313 azt_Play.start.min = msf.cdmsf_min0; #line 1314 azt_Play.start.sec = msf.cdmsf_sec0; #line 1315 azt_Play.start.frame = msf.cdmsf_frame0; #line 1316 azt_Play.end.min = msf.cdmsf_min1; #line 1317 azt_Play.end.sec = msf.cdmsf_sec1; #line 1318 azt_Play.end.frame = msf.cdmsf_frame1; #line 1325 i = aztPlay(& azt_Play); #line 1326 if (i < 0) { #line 1327 aztAudioStatus = 20; #line 1328 return (-5); } #line 1330 aztAudioStatus = 17; #line 1331 break; case 21253U: #line 1334 tocHdr.cdth_trk0 = DiskInfo.first; #line 1335 tocHdr.cdth_trk1 = DiskInfo.last; #line 1336 tmp___12 = copy_to_user(argp, (void const *)(& tocHdr), sizeof(tocHdr)); #line 1336 if (tmp___12) { #line 1337 return (-14); } #line 1338 break; case 21254U: #line 1340 tmp___13 = copy_from_user((void *)(& entry), argp, sizeof(entry)); #line 1340 if (tmp___13) { #line 1341 return (-14); } #line 1342 if (! aztTocUpToDate) { #line 1343 aztUpdateToc(); } else #line 1342 if (aztDiskChanged) { #line 1343 aztUpdateToc(); } #line 1344 if ((int )entry.cdte_track == 170) { #line 1345 tocPtr = & Toc[(int )DiskInfo.last + 1]; } else #line 1346 if ((int )entry.cdte_track > (int )DiskInfo.last) { #line 1348 return (-22); } else #line 1346 if ((int )entry.cdte_track < (int )DiskInfo.first) { #line 1348 return (-22); } else { #line 1350 tocPtr = & Toc[entry.cdte_track]; } #line 1351 entry.cdte_adr = tocPtr->ctrl_addr; #line 1352 entry.cdte_ctrl = (__u8 )((int )tocPtr->ctrl_addr >> 4); #line 1353 if ((int )entry.cdte_format == 1) { #line 1354 tmp___14 = azt_msf2hsg(& tocPtr->diskTime); #line 1354 entry.cdte_addr.lba = (int )tmp___14; } else #line 1356 if ((int )entry.cdte_format == 2) { #line 1357 tmp___15 = azt_bcd2bin(tocPtr->diskTime.min); #line 1357 entry.cdte_addr.msf.minute = (__u8 )tmp___15; #line 1359 tmp___16 = azt_bcd2bin(tocPtr->diskTime.sec); #line 1359 entry.cdte_addr.msf.second = (__u8 )tmp___16; #line 1361 tmp___17 = azt_bcd2bin(tocPtr->diskTime.frame); #line 1361 entry.cdte_addr.msf.frame = (__u8 )tmp___17; } else { #line 1364 return (-22); } #line 1366 tmp___18 = copy_to_user(argp, (void const *)(& entry), sizeof(entry)); #line 1366 if (tmp___18) { #line 1367 return (-14); } #line 1368 break; case 21259U: #line 1370 tmp___19 = copy_from_user((void *)(& subchnl), argp, sizeof(struct cdrom_subchnl )); #line 1370 if (tmp___19) { #line 1372 return (-14); } #line 1373 tmp___20 = aztGetQChannelInfo(& qInfo); #line 1373 if (tmp___20 < 0) { #line 1379 return (-5); } #line 1381 subchnl.cdsc_audiostatus = (__u8 )aztAudioStatus; #line 1382 subchnl.cdsc_adr = qInfo.ctrl_addr; #line 1383 subchnl.cdsc_ctrl = (__u8 )((int )qInfo.ctrl_addr >> 4); #line 1384 tmp___21 = azt_bcd2bin(qInfo.track); #line 1384 subchnl.cdsc_trk = (__u8 )tmp___21; #line 1385 tmp___22 = azt_bcd2bin(qInfo.pointIndex); #line 1385 subchnl.cdsc_ind = (__u8 )tmp___22; #line 1386 if ((int )subchnl.cdsc_format == 1) { #line 1387 tmp___23 = azt_msf2hsg(& qInfo.diskTime); #line 1387 subchnl.cdsc_absaddr.lba = (int )tmp___23; #line 1389 tmp___24 = azt_msf2hsg(& qInfo.trackTime); #line 1389 subchnl.cdsc_reladdr.lba = (int )tmp___24; } else { #line 1392 subchnl.cdsc_format = (__u8 )2; #line 1393 tmp___25 = azt_bcd2bin(qInfo.diskTime.min); #line 1393 subchnl.cdsc_absaddr.msf.minute = (__u8 )tmp___25; #line 1395 tmp___26 = azt_bcd2bin(qInfo.diskTime.sec); #line 1395 subchnl.cdsc_absaddr.msf.second = (__u8 )tmp___26; #line 1397 tmp___27 = azt_bcd2bin(qInfo.diskTime.frame); #line 1397 subchnl.cdsc_absaddr.msf.frame = (__u8 )tmp___27; #line 1399 tmp___28 = azt_bcd2bin(qInfo.trackTime.min); #line 1399 subchnl.cdsc_reladdr.msf.minute = (__u8 )tmp___28; #line 1401 tmp___29 = azt_bcd2bin(qInfo.trackTime.sec); #line 1401 subchnl.cdsc_reladdr.msf.second = (__u8 )tmp___29; #line 1403 tmp___30 = azt_bcd2bin(qInfo.trackTime.frame); #line 1403 subchnl.cdsc_reladdr.msf.frame = (__u8 )tmp___30; } #line 1406 tmp___31 = copy_to_user(argp, (void const *)(& subchnl), sizeof(struct cdrom_subchnl )); #line 1406 if (tmp___31) { #line 1407 return (-14); } #line 1408 break; case 21258U: #line 1413 tmp___32 = copy_from_user((void *)(& volctrl), argp, sizeof(volctrl)); #line 1413 if (tmp___32) { #line 1414 return (-14); } #line 1415 azt_Play.start.min = (unsigned char)33; #line 1416 azt_Play.start.sec = (unsigned char)132; #line 1417 azt_Play.start.frame = volctrl.channel0; #line 1418 azt_Play.end.min = volctrl.channel1; #line 1419 azt_Play.end.sec = volctrl.channel2; #line 1420 azt_Play.end.frame = volctrl.channel3; #line 1421 sendAztCmd(147, & azt_Play); #line 1422 statusAzt(); #line 1423 break; case 21257U: #line 1425 aztUnlockDoor(); #line 1427 if (aztAudioStatus == 17) { #line 1428 tmp___33 = aztSendCmd(129); #line 1428 if (tmp___33) { #line 1429 printk("aztcd: Warning: %s failed\n", "azt_ioctl 10"); #line 1429 return (-1); } #line 1430 statusAzt(); } #line 1432 tmp___34 = aztSendCmd(96); #line 1432 if (tmp___34) { #line 1433 printk("aztcd: Warning: %s failed\n", "azt_ioctl 11"); #line 1433 return (-1); } #line 1434 statusAzt(); #line 1435 aztAudioStatus = 21; #line 1436 break; case 21263U: #line 1438 azt_auto_eject = (char )arg; #line 1439 break; case 21266U: #line 1441 outb((unsigned char)16, (unsigned int )aztcd); #line 1442 sten_low(); #line 1443 tmp___35 = inb((unsigned int )aztcd); #line 1443 if ((int )tmp___35 != 1) { #line 1444 printk("aztcd: AZTECH CD-ROM drive does not respond\n"); } #line 1447 break; case 21268U: case 21269U: #line 1456 tmp___36 = copy_from_user((void *)(& msf), argp, sizeof(msf)); #line 1456 if (tmp___36) { #line 1457 return (-14); } #line 1459 azt_bin2bcd(& msf.cdmsf_min0); #line 1460 azt_bin2bcd(& msf.cdmsf_sec0); #line 1461 azt_bin2bcd(& msf.cdmsf_frame0); #line 1462 msf.cdmsf_min1 = (__u8 )0; #line 1463 msf.cdmsf_sec1 = (__u8 )0; #line 1464 msf.cdmsf_frame1 = (__u8 )1; #line 1465 azt_Play.start.min = msf.cdmsf_min0; #line 1466 azt_Play.start.sec = msf.cdmsf_sec0; #line 1467 azt_Play.start.frame = msf.cdmsf_frame0; #line 1468 azt_Play.end.min = msf.cdmsf_min1; #line 1469 azt_Play.end.sec = msf.cdmsf_sec1; #line 1470 azt_Play.end.frame = msf.cdmsf_frame1; #line 1471 if (cmd == 21268U) { #line 1472 if (DiskInfo.xa) { #line 1473 return (-1); } else { #line 1475 tmp___37 = sendAztCmd(33, & azt_Play); #line 1475 if (tmp___37) { #line 1476 return (-1); } #line 1477 dten_low(); #line 1478 insb((unsigned int )aztcd, (void *)(buf), 2352UL); #line 1479 tmp___38 = copy_to_user(argp, (void const *)(& buf), 2352UL); #line 1479 if (tmp___38) { #line 1480 return (-14); } } } else { #line 1484 tmp___39 = sendAztCmd(32, & azt_Play); #line 1484 if (tmp___39) { #line 1485 return (-1); } #line 1486 dten_low(); #line 1487 insb((unsigned int )aztcd, (void *)(buf), 2048UL); #line 1488 tmp___40 = copy_to_user(argp, (void const *)(& buf), 2048UL); #line 1488 if (tmp___40) { #line 1489 return (-14); } } #line 1492 break; case 21270U: #line 1494 tmp___41 = copy_from_user((void *)(& msf), argp, sizeof(msf)); #line 1494 if (tmp___41) { #line 1495 return (-14); } #line 1497 azt_bin2bcd(& msf.cdmsf_min0); #line 1498 azt_bin2bcd(& msf.cdmsf_sec0); #line 1499 azt_bin2bcd(& msf.cdmsf_frame0); #line 1500 azt_Play.start.min = msf.cdmsf_min0; #line 1501 azt_Play.start.sec = msf.cdmsf_sec0; #line 1502 azt_Play.start.frame = msf.cdmsf_frame0; #line 1503 tmp___42 = aztSeek(& azt_Play); #line 1503 if (tmp___42) { #line 1504 return (-1); } #line 1505 break; case 21261U: #line 1508 tmp___43 = aztSetDiskType(1); #line 1508 return (tmp___43); case 21260U: #line 1510 tmp___44 = aztSetDiskType(2); #line 1510 return (tmp___44); default: #line 1512 return (-22); } #line 1518 return (0); } } #line 1525 "aztcd.c" void azt_transfer(void) { int tmp ; int bn ; struct request *tmp___0 ; int i ; int offs ; struct request *tmp___1 ; int nr_sectors ; struct request *tmp___2 ; struct request *tmp___3 ; struct request *tmp___4 ; struct request *tmp___5 ; struct request *tmp___6 ; struct request *tmp___7 ; struct request *tmp___8 ; struct request *tmp___9 ; { #line 1530 tmp = current_valid(); #line 1530 if (! tmp) { #line 1531 return; } #line 1533 while (1) { #line 1533 tmp___9 = elv_next_request(azt_queue); #line 1533 if (! tmp___9->nr_sectors) { #line 1533 break; } #line 1534 tmp___0 = elv_next_request(azt_queue); #line 1534 bn = (int )(tmp___0->sector / 4UL); #line 1536 i = 0; #line 1536 while (1) { #line 1536 if (i < 16) { #line 1536 if (! (azt_buf_bn[i] != (int volatile )bn)) { #line 1536 break; } } else { #line 1536 break; } #line 1536 i ++; } #line 1537 if (i < 16) { #line 1538 tmp___1 = elv_next_request(azt_queue); #line 1538 offs = (int )(((unsigned long )(i * 4) + (tmp___1->sector & 3UL)) * 512UL); #line 1539 tmp___2 = elv_next_request(azt_queue); #line 1539 nr_sectors = (int )(4UL - (tmp___2->sector & 3UL)); #line 1540 if (azt_buf_out != (int volatile )i) { #line 1541 azt_buf_out = (int volatile )i; #line 1542 if (azt_buf_bn[i] != (int volatile )bn) { #line 1543 azt_buf_out = (int volatile )-1; #line 1544 continue; } } #line 1547 tmp___4 = elv_next_request(azt_queue); #line 1547 if ((unsigned long )nr_sectors > tmp___4->nr_sectors) { #line 1548 tmp___3 = elv_next_request(azt_queue); #line 1548 nr_sectors = (int )tmp___3->nr_sectors; } #line 1549 tmp___5 = elv_next_request(azt_queue); #line 1549 memcpy((void *)tmp___5->buffer, (void const *)(azt_buf + offs), (__kernel_size_t )(nr_sectors * 512)); #line 1551 tmp___6 = elv_next_request(azt_queue); #line 1551 tmp___6->nr_sectors -= (unsigned long )nr_sectors; #line 1552 tmp___7 = elv_next_request(azt_queue); #line 1552 tmp___7->sector += (sector_t )nr_sectors; #line 1553 tmp___8 = elv_next_request(azt_queue); #line 1553 tmp___8->buffer += nr_sectors * 512; } else { #line 1555 azt_buf_out = (int volatile )-1; #line 1556 break; } } #line 1559 return; } } #line 1561 "aztcd.c" void do_aztcd_request(request_queue_t *q ) { struct request *tmp ; struct request *tmp___0 ; struct request *tmp___1 ; int tmp___2 ; int tmp___3 ; struct request *tmp___4 ; int tmp___5 ; { #line 1567 if (DiskInfo.audio) { #line 1568 printk("aztcd: Error, tried to mount an Audio CD\n"); #line 1569 tmp = elv_next_request(azt_queue); #line 1569 end_request(tmp, 0); #line 1570 return; } #line 1572 azt_transfer_is_active = (int volatile )1; #line 1573 while (1) { #line 1573 tmp___5 = current_valid(); #line 1573 if (! tmp___5) { #line 1573 break; } #line 1574 azt_transfer(); #line 1575 tmp___4 = elv_next_request(azt_queue); #line 1575 if (tmp___4->nr_sectors == 0UL) { #line 1576 tmp___0 = elv_next_request(azt_queue); #line 1576 end_request(tmp___0, 1); } else { #line 1578 azt_buf_out = (int volatile )-1; #line 1579 if ((unsigned int volatile )azt_state == (unsigned int volatile )0) { #line 1580 if (! aztTocUpToDate) { #line 1580 goto _L; } else #line 1580 if (aztDiskChanged) { _L: /* CIL Label */ #line 1581 tmp___3 = aztUpdateToc(); #line 1581 if (tmp___3 < 0) { #line 1582 while (1) { #line 1582 tmp___2 = current_valid(); #line 1582 if (! tmp___2) { #line 1582 break; } #line 1583 tmp___1 = elv_next_request(azt_queue); #line 1583 end_request(tmp___1, 0); } #line 1584 break; } } #line 1587 azt_state = (enum azt_state_e volatile )1; #line 1588 AztTries = 5; #line 1589 delay_timer.expires = jiffies + 1UL; #line 1589 delay_timer.function = (void (*)(unsigned long ))((void *)(& azt_poll)); #line 1589 add_timer(& delay_timer); } #line 1591 break; } } #line 1594 azt_transfer_is_active = (int volatile )0; #line 1601 return; } } #line 1604 "aztcd.c" void azt_invalidate_buffers(void) { int i ; { #line 1611 i = 0; #line 1611 while (i < 16) { #line 1612 azt_buf_bn[i] = (int volatile )-1; #line 1611 i ++; } #line 1613 azt_buf_out = (int volatile )-1; #line 1614 return; } } #line 1619 "aztcd.c" int aztcd_open(struct inode *ip , struct file *fp ) { int st ; int tmp ; { #line 1627 if (aztPresent == 0) { #line 1628 return (-6); } #line 1630 if (! azt_open_count) { #line 1630 if ((unsigned int volatile )azt_state == (unsigned int volatile )0) { #line 1631 azt_invalidate_buffers(); #line 1633 st = getAztStatus(); #line 1634 if (st == -1) { #line 1635 goto err_out; } #line 1637 if (st & 64) { #line 1638 printk("aztcd: Door Open?\n"); #line 1639 aztCloseDoor(); #line 1640 st = getAztStatus(); } #line 1643 if (st & 32) { #line 1644 printk("aztcd: Disk Changed or No Disk in Drive?\n"); #line 1646 aztTocUpToDate = (char)0; } else #line 1643 if (st & 2) { #line 1644 printk("aztcd: Disk Changed or No Disk in Drive?\n"); #line 1646 aztTocUpToDate = (char)0; } #line 1648 tmp = aztUpdateToc(); #line 1648 if (tmp) { #line 1649 goto err_out; } } } #line 1652 azt_open_count ++; #line 1653 aztLockDoor(); #line 1658 return (0); err_out: #line 1661 return (-5); } } #line 1668 "aztcd.c" int aztcd_release(struct inode *inode , struct file *file ) { { #line 1675 azt_open_count --; #line 1675 if (! azt_open_count) { #line 1676 azt_invalidate_buffers(); #line 1677 aztUnlockDoor(); #line 1678 if (azt_auto_eject) { #line 1679 aztSendCmd(96); } #line 1680 del_timer(& delay_timer); } #line 1682 return (0); } } #line 1685 "aztcd.c" struct gendisk *azt_disk ; #line 1691 "aztcd.c" int aztcd_init(void) { long count ; long max_count ; unsigned char result[50] ; int st ; void *status ; int i ; int ret ; struct resource *tmp ; unsigned char tmp___0 ; struct resource *tmp___1 ; struct resource *tmp___2 ; unsigned char tmp___3 ; unsigned char tmp___4 ; int tmp___5 ; { #line 1696 status = (void *)0; #line 1697 i = 0; #line 1698 ret = 0; #line 1700 if (aztcd == 0) { #line 1701 printk("<6>aztcd: no Aztech CD-ROM Initialization"); #line 1702 return (-5); } #line 1705 printk("<6>aztcd: AZTECH, ORCHID, OKANO, WEARNES, TXC, CyDROM CD-ROM Driver\n"); #line 1707 printk("<6>aztcd: (C) 1994-98 W.Zimmermann\n"); #line 1708 if (aztcd == -1) { #line 1709 printk("aztcd: DriverVersion=%s For IDE/ATAPI-drives use ide-cd.c\n", "2.60"); } else { #line 1713 printk("aztcd: DriverVersion=%s BaseAddress=0x%x For IDE/ATAPI-drives use ide-cd.c\n", "2.60", aztcd); } #line 1716 printk("<6>aztcd: If you have problems, read /usr/src/linux/Documentation/cdrom/aztcd\n"); #line 1738 if (aztcd == -1) { #line 1739 i = 0; #line 1739 while (1) { #line 1739 if (azt_port_auto[i] != 0) { #line 1739 if (! (i < 16)) { #line 1739 break; } } else { #line 1739 break; } #line 1740 aztcd = azt_port_auto[i]; #line 1741 printk("<6>aztcd: Autoprobing BaseAddress=0x%x\n", aztcd); #line 1744 tmp = request_region((unsigned long )aztcd, 4UL, "aztcd"); #line 1744 if (! tmp) { #line 1745 goto __Cont; } #line 1747 outb((unsigned char)4, (unsigned int )(aztcd + 2)); #line 1748 inb((unsigned int )aztcd); #line 1749 inb((unsigned int )aztcd); #line 1750 outb((unsigned char)160, (unsigned int )aztcd); #line 1752 aztTimeOutCount = 0UL; #line 1753 while (1) { #line 1754 aztIndatum = inb((unsigned int )(aztcd + 1)); #line 1755 aztTimeOutCount ++; #line 1756 if (aztTimeOutCount >= 10000UL) { #line 1757 break; } #line 1753 if (! ((int )aztIndatum & 4)) { #line 1753 break; } } #line 1759 tmp___0 = inb((unsigned int )aztcd); #line 1759 if ((int )tmp___0 == 1) { #line 1760 break; } else { #line 1763 release_region((unsigned long )aztcd, 4UL); } __Cont: /* CIL Label */ #line 1739 i ++; } #line 1766 if (azt_port_auto[i] == 0) { #line 1767 printk("<6>aztcd: no AZTECH CD-ROM drive found\n"); #line 1768 return (-5); } else #line 1766 if (i == 16) { #line 1767 printk("<6>aztcd: no AZTECH CD-ROM drive found\n"); #line 1768 return (-5); } } else { #line 1771 if (aztcd == 496) { #line 1772 tmp___1 = request_region((unsigned long )aztcd, 8UL, "aztcd"); #line 1772 status = (void *)tmp___1; } else #line 1771 if (aztcd == 368) { #line 1772 tmp___1 = request_region((unsigned long )aztcd, 8UL, "aztcd"); #line 1772 status = (void *)tmp___1; } else { #line 1774 tmp___2 = request_region((unsigned long )aztcd, 4UL, "aztcd"); #line 1774 status = (void *)tmp___2; } #line 1775 if (! status) { #line 1776 printk("<4>aztcd: conflict, I/O port (%X) already used\n", aztcd); #line 1778 return (-5); } #line 1781 if (aztcd == 496) { #line 1782 outb_p((unsigned char)160, (unsigned int )(aztcd + 6)); } else #line 1781 if (aztcd == 368) { #line 1782 outb_p((unsigned char)160, (unsigned int )(aztcd + 6)); } #line 1782 outb_p((unsigned char)16, (unsigned int )(aztcd + 6)); #line 1782 outb_p((unsigned char)0, (unsigned int )(aztcd + 7)); #line 1782 outb_p((unsigned char)16, (unsigned int )(aztcd + 6)); #line 1784 outb((unsigned char)4, (unsigned int )(aztcd + 2)); #line 1785 inb((unsigned int )aztcd); #line 1786 inb((unsigned int )aztcd); #line 1787 outb((unsigned char)160, (unsigned int )aztcd); #line 1789 aztTimeOutCount = 0UL; #line 1790 while (1) { #line 1791 aztIndatum = inb((unsigned int )(aztcd + 1)); #line 1792 aztTimeOutCount ++; #line 1793 if (aztTimeOutCount >= 10000UL) { #line 1794 break; } #line 1790 if (! ((int )aztIndatum & 4)) { #line 1790 break; } } #line 1797 tmp___4 = inb((unsigned int )aztcd); #line 1797 if ((int )tmp___4 != 1) { #line 1811 printk("<6>aztcd: drive reset - please wait\n"); #line 1813 count = 0L; #line 1813 while (count < 50L) { #line 1814 inb((unsigned int )(aztcd + 1)); #line 1815 inb((unsigned int )aztcd); #line 1813 count ++; } #line 1817 outb((unsigned char)4, (unsigned int )(aztcd + 2)); #line 1818 inb((unsigned int )aztcd); #line 1819 inb((unsigned int )aztcd); #line 1820 getAztStatus(); #line 1821 outb((unsigned char)16, (unsigned int )aztcd); #line 1822 sten_low(); #line 1823 tmp___3 = inb((unsigned int )aztcd); #line 1823 if ((int )tmp___3 != 1) { #line 1824 printk("<4>aztcd: no AZTECH CD-ROM drive found\n"); #line 1826 ret = -5; #line 1827 goto err_out; } #line 1830 count = 0L; #line 1830 while (count < 8000000L) { #line 1832 barrier(); #line 1830 count ++; } #line 1835 st = getAztStatus(); #line 1835 if (st == -1) { #line 1836 printk("<4>aztcd: Drive Status Error Status=%x\n", st); #line 1838 ret = -5; #line 1839 goto err_out; } #line 1844 outb((unsigned char)4, (unsigned int )(aztcd + 2)); #line 1845 inb((unsigned int )aztcd); #line 1846 inb((unsigned int )aztcd); #line 1847 outb((unsigned char)160, (unsigned int )aztcd); #line 1848 sten_low(); #line 1849 op_ok(); } } #line 1854 azt_init_end = (char)1; #line 1855 sten_low(); #line 1856 result[0] = inb((unsigned int )aztcd); #line 1857 count = 1L; #line 1857 while (count < 50L) { #line 1858 aztTimeOutCount = 0UL; #line 1859 while (1) { #line 1860 aztIndatum = inb((unsigned int )(aztcd + 1)); #line 1861 aztTimeOutCount ++; #line 1862 if (aztTimeOutCount >= 10000UL) { #line 1863 break; } #line 1859 if (! ((int )aztIndatum & 4)) { #line 1859 break; } } #line 1865 if (aztTimeOutCount >= 10000UL) { #line 1866 break; } #line 1867 result[count] = inb((unsigned int )aztcd); #line 1857 count ++; } #line 1869 if (count > 30L) { #line 1870 max_count = 30L; } else { #line 1872 max_count = count; } #line 1873 printk("<6>aztcd: FirmwareVersion="); #line 1874 count = 1L; #line 1874 while (count < max_count) { #line 1875 printk("%c", (int )result[count]); #line 1874 count ++; } #line 1876 printk("<<>> "); #line 1878 if ((int )result[1] == 65) { #line 1878 if ((int )result[2] == 90) { #line 1878 if ((int )result[3] == 84) { #line 1879 printk("AZTECH drive detected\n"); } else { #line 1878 goto _L___3; } } else { #line 1878 goto _L___3; } } else _L___3: /* CIL Label */ #line 1881 if ((int )result[2] == 67) { #line 1881 if ((int )result[3] == 68) { #line 1881 if ((int )result[4] == 68) { #line 1883 printk("ORCHID or WEARNES drive detected\n"); } else { #line 1881 goto _L___1; } } else { #line 1881 goto _L___1; } } else _L___1: /* CIL Label */ #line 1884 if ((int )result[1] == 3) { #line 1884 if ((int )result[2] == 53) { #line 1885 printk("TXC or CyCDROM drive detected\n"); } else { #line 1884 goto _L; } } else { _L: /* CIL Label */ #line 1887 printk("\nunknown drive or firmware version detected\n"); #line 1888 printk("aztcd may not run stable, if you want to try anyhow,\n"); #line 1890 printk("boot with: aztcd=<BaseAddress>,0x79\n"); #line 1891 if ((int )azt_cont != 121) { #line 1892 printk("aztcd: FirmwareVersion="); #line 1893 count = 1L; #line 1893 while (count < 5L) { #line 1894 printk("%c", (int )result[count]); #line 1893 count ++; } #line 1895 printk("<<>> "); #line 1896 printk("Aborted\n"); #line 1897 ret = -5; #line 1898 goto err_out; } } #line 1901 azt_disk = alloc_disk(1); #line 1902 if (! azt_disk) { #line 1903 goto err_out; } #line 1905 tmp___5 = register_blkdev(29U, "aztcd"); #line 1905 if (tmp___5) { #line 1906 ret = -5; #line 1907 goto err_out2; } #line 1910 azt_queue = blk_init_queue(& do_aztcd_request, & aztSpin); #line 1911 if (! azt_queue) { #line 1912 ret = -12; #line 1913 goto err_out3; } #line 1916 blk_queue_hardsect_size(azt_queue, (unsigned short)2048); #line 1917 azt_disk->major = 29; #line 1918 azt_disk->first_minor = 0; #line 1919 azt_disk->fops = & azt_fops; #line 1920 sprintf(azt_disk->disk_name, "aztcd"); #line 1921 sprintf(azt_disk->devfs_name, "aztcd"); #line 1922 azt_disk->queue = azt_queue; #line 1923 add_disk(azt_disk); #line 1924 azt_invalidate_buffers(); #line 1925 aztPresent = 1; #line 1926 aztCloseDoor(); #line 1927 return (0); err_out3: #line 1929 unregister_blkdev(29U, "aztcd"); err_out2: #line 1931 put_disk(azt_disk); err_out: #line 1933 if (aztcd == 496) { #line 1934 outb_p((unsigned char)160, (unsigned int )(aztcd + 6)); #line 1935 release_region((unsigned long )aztcd, 8UL); } else #line 1933 if (aztcd == 368) { #line 1934 outb_p((unsigned char)160, (unsigned int )(aztcd + 6)); #line 1935 release_region((unsigned long )aztcd, 8UL); } else { #line 1937 release_region((unsigned long )aztcd, 4UL); } #line 1938 return (ret); } } #line 1942 "aztcd.c" void aztcd_exit(void) { int tmp ; { #line 1944 del_gendisk(azt_disk); #line 1945 put_disk(azt_disk); #line 1946 tmp = unregister_blkdev(29U, "aztcd"); #line 1946 if (tmp == -22) { #line 1947 printk("What\'s that: can\'t unregister aztcd\n"); #line 1948 return; } #line 1950 blk_cleanup_queue(azt_queue); #line 1951 if (aztcd == 496) { #line 1952 outb_p((unsigned char)160, (unsigned int )(aztcd + 6)); #line 1953 release_region((unsigned long )aztcd, 8UL); } else #line 1951 if (aztcd == 368) { #line 1952 outb_p((unsigned char)160, (unsigned int )(aztcd + 6)); #line 1953 release_region((unsigned long )aztcd, 8UL); } else { #line 1955 release_region((unsigned long )aztcd, 4UL); } #line 1956 printk("<6>aztcd module released.\n"); #line 1957 return; } } #line 1959 "aztcd.c" int (*_ddv_tmp_init)(void) = & aztcd_init; #line 1960 "aztcd.c" void (*_ddv_tmp_exit)(void) = & aztcd_exit; #line 1966 "aztcd.c" void azt_poll(void) { int st ; int loop_ctl ; int skip ; int tmp ; unsigned char tmp___0 ; struct request *tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; struct request *tmp___5 ; struct request *tmp___6 ; char const *tmp___7 ; struct request *tmp___8 ; int tmp___9 ; int tmp___10 ; struct request *tmp___11 ; char const *tmp___12 ; struct request *tmp___13 ; int tmp___14 ; struct azt_Play_msf msf ; int i ; struct request *tmp___15 ; long tmp___16 ; long tmp___17 ; long tmp___18 ; long tmp___19 ; long tmp___20 ; long tmp___21 ; int tmp___22 ; unsigned char tmp___23 ; struct request *tmp___24 ; int tmp___25 ; int tmp___26 ; int tmp___27 ; struct request *tmp___28 ; struct request *tmp___29 ; int volatile tmp___30 ; struct request *tmp___31 ; struct request *tmp___32 ; int tmp___33 ; int tmp___34 ; struct request *tmp___35 ; struct request *tmp___36 ; int i___0 ; unsigned char tmp___37 ; int tmp___38 ; struct request *tmp___39 ; int tmp___40 ; int tmp___41 ; int tmp___42 ; { #line 1968 st = 0; #line 1969 loop_ctl = 1; #line 1970 skip = 0; #line 1972 if (azt_error) { #line 1973 tmp = aztSendCmd(64); #line 1973 if (tmp) { #line 1974 printk("aztcd: Warning: %s failed\n", "azt_poll 1"); #line 1974 return; } #line 1975 sten_low(); #line 1976 tmp___0 = inb((unsigned int )aztcd); #line 1976 azt_error = (int volatile )((int )tmp___0 & 255); #line 1977 printk("aztcd: I/O error 0x%02x\n", azt_error); #line 1978 azt_invalidate_buffers(); #line 1985 tmp___3 = AztTries; #line 1985 AztTries --; #line 1985 if (! tmp___3) { #line 1986 printk("aztcd: Read of Block %d Failed, Maybe Audio Disk? Giving up\n", azt_next_bn); #line 1989 if (azt_transfer_is_active) { #line 1990 AztTries = 0; #line 1991 loop_ctl = 0; } #line 1993 tmp___2 = current_valid(); #line 1993 if (tmp___2) { #line 1994 tmp___1 = elv_next_request(azt_queue); #line 1994 end_request(tmp___1, 0); } #line 1995 AztTries = 5; } #line 1997 azt_error = (int volatile )0; #line 1998 azt_state = (enum azt_state_e volatile )5; } #line 2001 while (loop_ctl) { #line 2002 loop_ctl = 0; #line 2004 switch ((unsigned int volatile )azt_state) { case (unsigned int volatile )0: #line 2013 return; case (unsigned int volatile )1: #line 2022 tmp___4 = aztSendCmd(65); #line 2022 if (tmp___4) { #line 2023 printk("aztcd: Warning: %s failed\n", "azt_poll 2"); #line 2023 return; } #line 2024 if (azt_mode == 1) { #line 2024 azt_state = (enum azt_state_e volatile )3; } else { #line 2024 azt_state = (enum azt_state_e volatile )2; } #line 2026 AztTimeout = 3000; #line 2027 break; case (unsigned int volatile )2: #line 2036 if (! skip) { #line 2037 st = aztStatus(); #line 2037 if (st != -1) { #line 2038 if (st & 2) { #line 2038 goto _L; } else #line 2038 if (st & 32) { _L: /* CIL Label */ #line 2040 aztDiskChanged = (char)1; #line 2041 aztTocUpToDate = (char)0; #line 2042 azt_invalidate_buffers(); #line 2043 tmp___5 = elv_next_request(azt_queue); #line 2043 end_request(tmp___5, 0); #line 2044 printk("aztcd: Disk Changed or Not Ready 1 - Unmount Disk!\n"); } } else { #line 2048 break; } } #line 2050 skip = 0; #line 2052 if (st & 64) { #line 2052 goto _L___0; } else #line 2052 if (st & 32) { _L___0: /* CIL Label */ #line 2053 aztDiskChanged = (char)1; #line 2054 aztTocUpToDate = (char)0; #line 2055 printk("aztcd: Disk Changed or Not Ready 2 - Unmount Disk!\n"); #line 2057 tmp___6 = elv_next_request(azt_queue); #line 2057 end_request(tmp___6, 0); #line 2058 if (st & 64) { #line 2058 tmp___7 = "aztcd: door open\n"; } else { #line 2058 tmp___7 = "aztcd: disk removed\n"; } #line 2058 printk(tmp___7); #line 2061 if (azt_transfer_is_active) { #line 2062 azt_state = (enum azt_state_e volatile )1; #line 2063 loop_ctl = 1; #line 2064 break; } #line 2066 azt_state = (enum azt_state_e volatile )0; #line 2067 while (1) { #line 2067 tmp___9 = current_valid(); #line 2067 if (! tmp___9) { #line 2067 break; } #line 2068 tmp___8 = elv_next_request(azt_queue); #line 2068 end_request(tmp___8, 0); } #line 2069 return; } #line 2077 tmp___10 = aztSendCmd(65); #line 2077 if (tmp___10) { #line 2078 printk("aztcd: Warning: %s failed\n", "azt_poll 4"); #line 2078 return; } #line 2079 sten_low(); #line 2080 azt_mode = 1; #line 2081 azt_state = (enum azt_state_e volatile )3; #line 2082 AztTimeout = 3000; #line 2084 break; case (unsigned int volatile )3: #line 2094 if (! skip) { #line 2095 st = aztStatus(); #line 2095 if (st != -1) { #line 2096 if (st & 2) { #line 2096 goto _L___1; } else #line 2096 if (st & 32) { _L___1: /* CIL Label */ #line 2098 aztDiskChanged = (char)1; #line 2099 aztTocUpToDate = (char)0; #line 2100 azt_invalidate_buffers(); #line 2101 printk("aztcd: Disk Changed or Not Ready 3 - Unmount Disk!\n"); #line 2103 tmp___11 = elv_next_request(azt_queue); #line 2103 end_request(tmp___11, 0); } } else { #line 2106 break; } } #line 2109 skip = 0; #line 2110 if (st & 64) { #line 2110 goto _L___2; } else #line 2110 if (st & 32) { _L___2: /* CIL Label */ #line 2111 aztDiskChanged = (char)1; #line 2112 aztTocUpToDate = (char)0; #line 2113 if (st & 64) { #line 2113 tmp___12 = "aztcd: door open\n"; } else { #line 2113 tmp___12 = "aztcd: disk removed\n"; } #line 2113 printk(tmp___12); #line 2116 if (azt_transfer_is_active) { #line 2117 azt_state = (enum azt_state_e volatile )1; #line 2118 loop_ctl = 1; #line 2119 break; } #line 2121 azt_state = (enum azt_state_e volatile )0; #line 2122 while (1) { #line 2122 tmp___14 = current_valid(); #line 2122 if (! tmp___14) { #line 2122 break; } #line 2123 tmp___13 = elv_next_request(azt_queue); #line 2123 end_request(tmp___13, 0); } #line 2124 return; } #line 2127 tmp___22 = current_valid(); #line 2127 if (tmp___22) { #line 2130 tmp___15 = elv_next_request(azt_queue); #line 2130 azt_next_bn = (int volatile )(tmp___15->sector / 4UL); #line 2131 azt_hsg2msf((long )azt_next_bn, & msf.start); #line 2132 i = 0; #line 2134 while (1) { #line 2134 tmp___16 = azt_msf2hsg(& msf.start); #line 2134 i ++; #line 2134 tmp___17 = azt_msf2hsg(& Toc[i].trackTime); #line 2134 if (! (tmp___16 > tmp___17)) { #line 2134 break; } } #line 2137 tmp___20 = azt_msf2hsg(& msf.start); #line 2137 tmp___21 = azt_msf2hsg(& Toc[i].trackTime); #line 2137 if (tmp___20 < tmp___21 - 16L) { #line 2140 azt_read_count = (int volatile )16; } else { #line 2145 tmp___18 = azt_msf2hsg(& Toc[i].trackTime); #line 2145 tmp___19 = azt_msf2hsg(& msf.start); #line 2145 azt_read_count = (int volatile )((tmp___18 / 4L) * 4L - tmp___19); #line 2149 if (azt_read_count < (int volatile )0) { #line 2150 azt_read_count = (int volatile )0; } #line 2151 if (azt_read_count > (int volatile )16) { #line 2152 azt_read_count = (int volatile )16; } #line 2154 printk("aztcd: warning - trying to read beyond end of track\n"); } #line 2163 msf.end.min = (unsigned char)0; #line 2164 msf.end.sec = (unsigned char)0; #line 2165 msf.end.frame = (unsigned char )azt_read_count; #line 2177 if ((unsigned int volatile )azt_read_mode == (unsigned int volatile )2) { #line 2178 sendAztCmd(33, & msf); } else { #line 2180 sendAztCmd(32, & msf); } #line 2182 azt_state = (enum azt_state_e volatile )4; #line 2183 AztTimeout = 3000; } else { #line 2185 azt_state = (enum azt_state_e volatile )5; #line 2186 loop_ctl = 1; #line 2187 break; } #line 2190 break; case (unsigned int volatile )4: #line 2201 tmp___23 = inb((unsigned int )(aztcd + 1)); #line 2201 st = (int )tmp___23 & 6; #line 2203 switch (st) { case 2: #line 2212 tmp___26 = AztTries; #line 2212 AztTries --; #line 2212 if (! tmp___26) { #line 2213 printk("aztcd: Read of Block %d Failed, Maybe Audio Disk ? Giving up\n", azt_next_bn); #line 2216 if (azt_transfer_is_active) { #line 2217 AztTries = 0; #line 2218 break; } #line 2220 tmp___25 = current_valid(); #line 2220 if (tmp___25) { #line 2221 tmp___24 = elv_next_request(azt_queue); #line 2221 end_request(tmp___24, 0); } #line 2222 AztTries = 5; } #line 2224 azt_state = (enum azt_state_e volatile )1; #line 2225 AztTimeout = 3000; #line 2226 loop_ctl = 1; #line 2227 break; case 6: #line 2238 break; default: #line 2247 AztTries = 5; #line 2248 tmp___27 = current_valid(); #line 2248 if (! tmp___27) { #line 2248 if (azt_buf_in == azt_buf_out) { #line 2249 azt_state = (enum azt_state_e volatile )5; #line 2250 loop_ctl = 1; #line 2251 break; } } #line 2253 if (azt_read_count <= (int volatile )0) { #line 2254 printk("aztcd: warning - try to read 0 frames\n"); } #line 2256 while (azt_read_count) { #line 2257 azt_buf_bn[azt_buf_in] = (int volatile )-1; #line 2258 dten_low(); #line 2267 if (aztTimeOutCount >= 8000000UL) { #line 2268 tmp___28 = elv_next_request(azt_queue); #line 2268 printk("read_count:%d CURRENT->nr_sectors:%ld azt_buf_in:%d\n", azt_read_count, tmp___28->nr_sectors, azt_buf_in); #line 2273 printk("azt_transfer_is_active:%x\n", azt_transfer_is_active); #line 2276 azt_read_count = (int volatile )0; #line 2277 azt_state = (enum azt_state_e volatile )5; #line 2278 loop_ctl = 1; #line 2279 tmp___29 = elv_next_request(azt_queue); #line 2279 end_request(tmp___29, 1); } else { #line 2281 if ((unsigned int volatile )azt_read_mode == (unsigned int volatile )2) { #line 2283 insb((unsigned int )aztcd, (void *)(azt_buf + 2352 * (int )azt_buf_in), 2352UL); } else { #line 2289 insb((unsigned int )aztcd, (void *)(azt_buf + 2048 * (int )azt_buf_in), 2048UL); } #line 2295 azt_read_count -= (int volatile )1; #line 2308 tmp___30 = azt_next_bn; #line 2308 azt_next_bn += (int volatile )1; #line 2308 azt_buf_bn[azt_buf_in] = tmp___30; #line 2310 if (azt_buf_out == (int volatile )-1) { #line 2311 azt_buf_out = azt_buf_in; } #line 2313 if (azt_buf_in + (int volatile )1 == (int volatile )16) { #line 2313 azt_buf_in = (int volatile )0; } else { #line 2313 azt_buf_in += (int volatile )1; } } } #line 2319 if (! azt_transfer_is_active) { #line 2320 while (1) { #line 2320 tmp___33 = current_valid(); #line 2320 if (! tmp___33) { #line 2320 break; } #line 2321 azt_transfer(); #line 2322 tmp___32 = elv_next_request(azt_queue); #line 2322 if (tmp___32->nr_sectors == 0UL) { #line 2324 tmp___31 = elv_next_request(azt_queue); #line 2324 end_request(tmp___31, 1); } else { #line 2326 break; } } } #line 2330 tmp___34 = current_valid(); #line 2330 if (tmp___34) { #line 2330 tmp___35 = elv_next_request(azt_queue); #line 2330 if (tmp___35->sector / 4UL < (sector_t )azt_next_bn) { #line 2334 azt_state = (enum azt_state_e volatile )5; #line 2335 loop_ctl = 1; #line 2336 break; } else { #line 2330 tmp___36 = elv_next_request(azt_queue); #line 2330 if (tmp___36->sector / 4UL > (sector_t )(azt_next_bn + (int volatile )16)) { #line 2334 azt_state = (enum azt_state_e volatile )5; #line 2335 loop_ctl = 1; #line 2336 break; } } } #line 2338 AztTimeout = 3000; #line 2339 if (azt_read_count == (int volatile )0) { #line 2340 azt_state = (enum azt_state_e volatile )5; #line 2341 loop_ctl = 1; #line 2342 break; } #line 2344 break; } #line 2346 break; case (unsigned int volatile )5: #line 2356 if (azt_read_count != (int volatile )0) { #line 2357 printk("aztcd: discard data=%x frames\n", azt_read_count); } #line 2359 while (azt_read_count != (int volatile )0) { #line 2361 tmp___37 = inb((unsigned int )(aztcd + 1)); #line 2361 if (! ((int )tmp___37 & 2)) { #line 2362 if ((unsigned int volatile )azt_read_mode == (unsigned int volatile )2) { #line 2363 i___0 = 0; #line 2363 while (i___0 < 2352) { #line 2366 inb((unsigned int )aztcd); #line 2363 i___0 ++; } } else { #line 2368 i___0 = 0; #line 2368 while (i___0 < 2048) { #line 2370 inb((unsigned int )aztcd); #line 2368 i___0 ++; } } } #line 2372 azt_read_count -= (int volatile )1; } #line 2374 tmp___38 = aztSendCmd(65); #line 2374 if (tmp___38) { #line 2375 printk("aztcd: Warning: %s failed\n", "azt_poll 5"); #line 2375 return; } #line 2376 azt_state = (enum azt_state_e volatile )6; #line 2377 AztTimeout = 1000; #line 2378 break; case (unsigned int volatile )6: #line 2388 st = aztStatus(); #line 2388 if (st == -1) { #line 2388 if (AztTimeout) { #line 2389 break; } } #line 2391 if (st != -1) { #line 2391 if (st & 2) { #line 2391 goto _L___3; } else #line 2391 if (st & 32) { _L___3: /* CIL Label */ #line 2394 aztDiskChanged = (char)1; #line 2395 aztTocUpToDate = (char)0; #line 2396 azt_invalidate_buffers(); #line 2397 printk("aztcd: Disk Changed or Not Ready 4 - Unmount Disk!\n"); #line 2399 tmp___39 = elv_next_request(azt_queue); #line 2399 end_request(tmp___39, 0); } } #line 2407 tmp___40 = current_valid(); #line 2407 if (tmp___40) { #line 2408 if (st != -1) { #line 2409 if (azt_mode == 1) { #line 2410 azt_state = (enum azt_state_e volatile )3; #line 2411 loop_ctl = 1; #line 2412 skip = 1; #line 2413 break; } else { #line 2415 azt_state = (enum azt_state_e volatile )2; #line 2416 loop_ctl = 1; #line 2417 skip = 1; #line 2418 break; } } else { #line 2421 azt_state = (enum azt_state_e volatile )1; #line 2422 AztTimeout = 1; } } else { #line 2425 azt_state = (enum azt_state_e volatile )0; #line 2426 return; } #line 2428 break; default: #line 2431 printk("aztcd: invalid state %d\n", (unsigned int volatile )azt_state); #line 2432 return; } } #line 2437 tmp___42 = AztTimeout; #line 2437 AztTimeout --; #line 2437 if (! tmp___42) { #line 2438 printk("aztcd: timeout in state %d\n", (unsigned int volatile )azt_state); #line 2439 azt_state = (enum azt_state_e volatile )5; #line 2440 tmp___41 = aztSendCmd(129); #line 2440 if (tmp___41) { #line 2441 printk("aztcd: Warning: %s failed\n", "azt_poll 6"); #line 2441 return; } #line 2442 statusAzt(); } #line 2445 delay_timer.expires = jiffies + 1UL; #line 2445 delay_timer.function = (void (*)(unsigned long ))((void *)(& azt_poll)); #line 2445 add_timer(& delay_timer); #line 2446 return; } } #line 2453 "aztcd.c" void azt_hsg2msf(long hsg , struct msf *msf ) { { #line 2455 hsg += 150L; #line 2456 msf->min = (unsigned char )(hsg / 4500L); #line 2457 hsg %= 4500L; #line 2458 msf->sec = (unsigned char )(hsg / 75L); #line 2459 msf->frame = (unsigned char )(hsg % 75L); #line 2468 azt_bin2bcd(& msf->min); #line 2469 azt_bin2bcd(& msf->sec); #line 2470 azt_bin2bcd(& msf->frame); #line 2471 return; } } #line 2473 "aztcd.c" long azt_msf2hsg(struct msf *mp ) { int tmp ; int tmp___0 ; int tmp___1 ; { #line 2475 tmp = azt_bcd2bin(mp->frame); #line 2475 tmp___0 = azt_bcd2bin(mp->sec); #line 2475 tmp___1 = azt_bcd2bin(mp->min); #line 2475 return ((long )(((tmp + tmp___0 * 75) + tmp___1 * 4500) - 150)); } } #line 2479 "aztcd.c" void azt_bin2bcd(unsigned char *p ) { int u ; int t ; { #line 2483 u = (int )*p % 10; #line 2484 t = (int )*p / 10; #line 2485 *p = (unsigned char )(u | (t << 4)); #line 2486 return; } } #line 2488 "aztcd.c" int azt_bcd2bin(unsigned char bcd ) { { #line 2490 return (((int )bcd >> 4) * 10 + ((int )bcd & 15)); } } #line 2493 "aztcd.c" char _ddv_module_license[4] = { (char )'G', (char )'P', (char )'L', (char )'\000'}; #line 2494 "aztcd.c" int _ddv_module_param_major = 29; #line 4 "__main.c" int main(void) { { #line 6 _ddv_module_init = & aztcd_init; #line 7 _ddv_module_exit = & aztcd_exit; #line 8 call_ddv(); #line 10 return (0); } } #line 1 "manage.o" #pragma merger("0","/tmp/cil-b_5yc1Nw.i","") #line 75 "/usr/local/ddv/models/con2/include/linux/interrupt.h" int request_irq(unsigned int irq , irqreturn_t (*handler)(int , void * , struct pt_regs * ) , unsigned long irqflags , char const *devname , void *dev_id ) ; #line 78 void free_irq(unsigned int irq , void *dev_id ) ; #line 4 "/usr/local/ddv/models/con2/src/linux/kernel/irq/manage.c" int request_irq(unsigned int irq , irqreturn_t (*handler)(int , void * , struct pt_regs * ) , unsigned long irqflags , char const *devname , void *dev_id ) { int tmp ; { #line 7 tmp = nondet_int(); #line 7 if (tmp) { #line 8 registered_irq[irq].handler = handler; #line 9 registered_irq[irq].dev_id = dev_id; #line 11 return (0); } else { #line 13 return (-1); } } } #line 17 "/usr/local/ddv/models/con2/src/linux/kernel/irq/manage.c" void free_irq(unsigned int irq , void *dev_id ) { { #line 19 registered_irq[irq].handler = (irqreturn_t (*)(int , void * , struct pt_regs * ))((void *)0); #line 20 registered_irq[irq].dev_id = (void *)0; #line 21 return; } } #line 1 "misc.o" #pragma merger("0","/tmp/cil-qHZ7UWq9.i","") #line 40 "/usr/local/ddv/models/con2/include/linux/miscdevice.h" int misc_register(struct miscdevice *misc ) ; #line 11 "/usr/local/ddv/models/con2/include/linux/proc_fs.h" struct proc_dir_entry *proc_root_driver ; #line 18 "/usr/local/ddv/models/con2/src/linux/drivers/char/misc.c" int misc_register(struct miscdevice *misc ) { int i ; dev_t dev ; int tmp ; { #line 23 if (fixed_cdev_used < 10) { #line 24 i = fixed_cdev_used; #line 25 fixed_cdev_used ++; #line 27 fixed_cdev[i].owner = (struct module *)0; #line 28 fixed_cdev[i].ops = misc->fops; #line 30 dev = (dev_t )((10 << 20) | misc->minor); #line 32 tmp = cdev_add(& fixed_cdev[i], dev, 0U); #line 32 return (tmp); } else { #line 34 return (-1); } } } #line 1 "mutex.o" #pragma merger("0","/tmp/cil-JVG4dUf5.i","") #line 32 "/usr/local/ddv/models/con2/include/ddverify/ddverify.h" __inline static int assert_context_process(void) { { #line 34 return (0); } } #line 32 "/usr/local/ddv/models/con2/include/linux/mutex.h" __inline void mutex_init(struct mutex *lock ) ; #line 34 __inline void mutex_lock(struct mutex *lock ) ; #line 36 __inline void mutex_unlock(struct mutex *lock ) ; #line 4 "/usr/local/ddv/models/con2/src/linux/kernel/mutex.c" __inline void mutex_init(struct mutex *lock ) { { #line 7 __CPROVER_atomic_begin(); #line 11 lock->locked = 0; #line 12 lock->init = 1; #line 13 __CPROVER_atomic_end(); #line 14 return; } } #line 16 "/usr/local/ddv/models/con2/src/linux/kernel/mutex.c" __inline void mutex_lock(struct mutex *lock ) { { #line 27 while (1) { #line 29 __CPROVER_atomic_begin(); #line 30 if (lock->locked == 0) { #line 32 lock->locked = 1; #line 33 __CPROVER_atomic_end(); #line 34 return; } #line 36 __CPROVER_atomic_end(); } } } #line 41 "/usr/local/ddv/models/con2/src/linux/kernel/mutex.c" __inline void mutex_unlock(struct mutex *lock ) { { #line 44 __CPROVER_atomic_begin(); #line 45 assert_context_process(); #line 49 lock->locked = 0; #line 50 __CPROVER_atomic_end(); #line 51 return; } } #line 1 "page_alloc.o" #pragma merger("0","/tmp/cil-hV07oMya.i","") #line 55 "/usr/local/ddv/models/con2/include/linux/gfp.h" __inline unsigned long __get_free_pages(gfp_t gfp_mask , unsigned int order ) ; #line 57 __inline unsigned long __get_free_page(gfp_t gfp_mask ) ; #line 59 __inline unsigned long get_zeroed_page(gfp_t gfp_mask ) ; #line 70 __inline struct page *alloc_pages(gfp_t gfp_mask , unsigned int order ) ; #line 72 __inline struct page *alloc_page(gfp_t gfp_mask ) ; #line 5 "/usr/local/ddv/models/con2/src/linux/mm/page_alloc.c" __inline unsigned long __get_free_pages(gfp_t gfp_mask , unsigned int order ) { { #line 8 if (gfp_mask & 16U) { #line 9 assert_context_process(); } #line 11 return (0UL); } } #line 13 "/usr/local/ddv/models/con2/src/linux/mm/page_alloc.c" __inline unsigned long __get_free_page(gfp_t gfp_mask ) { { #line 16 if (gfp_mask & 16U) { #line 17 assert_context_process(); } #line 19 return (0UL); } } #line 38 "/usr/local/ddv/models/con2/src/linux/mm/page_alloc.c" __inline struct page *alloc_pages(gfp_t gfp_mask , unsigned int order ) { { #line 41 if (gfp_mask & 16U) { #line 42 assert_context_process(); } #line 44 return ((struct page *)0); } } #line 46 "/usr/local/ddv/models/con2/src/linux/mm/page_alloc.c" __inline struct page *alloc_page(gfp_t gfp_mask ) { { #line 49 if (gfp_mask & 16U) { #line 50 assert_context_process(); } #line 52 return ((struct page *)0); } } #line 1 "pci.o" #pragma merger("0","/tmp/cil-H6nAfQ1t.i","") #line 96 "/usr/local/ddv/models/con2/include/linux/ioport.h" extern struct resource *request_mem_region(unsigned long start , unsigned long len , char const *name ) ; #line 98 extern void release_mem_region(unsigned long start , unsigned long len ) ; #line 87 "/usr/local/ddv/models/con2/include/linux/pci.h" __inline struct pci_dev *pci_get_class(unsigned int class , struct pci_dev *from ) ; #line 141 __inline int pci_register_driver(struct pci_driver *driver ) ; #line 143 __inline void pci_unregister_driver(struct pci_driver *driver ) ; #line 145 __inline int pci_enable_device(struct pci_dev *dev ) ; #line 152 __inline int pci_request_regions(struct pci_dev *pdev , char const *res_name ) ; #line 154 __inline void pci_release_regions(struct pci_dev *pdev ) ; #line 156 __inline int pci_request_region(struct pci_dev *pdev , int bar , char const *res_name ) ; #line 158 __inline void pci_release_region(struct pci_dev *pdev , int bar ) ; #line 8 "/usr/local/ddv/models/con2/src/linux/pci.c" __inline int pci_enable_device(struct pci_dev *dev ) { int i ; unsigned int tmp ; unsigned short tmp___0 ; { #line 12 i = 0; #line 12 while (i < 12) { #line 13 dev->resource[i].flags = 256UL; #line 14 tmp = nondet_uint(); #line 14 dev->resource[i].start = (unsigned long )tmp; #line 15 tmp___0 = nondet_ushort(); #line 15 dev->resource[i].end = dev->resource[i].start + (unsigned long )tmp___0; #line 12 i ++; } #line 17 return (0); } } #line 19 "/usr/local/ddv/models/con2/src/linux/pci.c" __inline struct pci_dev *pci_get_class(unsigned int class , struct pci_dev *from ) { void *tmp ; int tmp___0 ; { #line 21 if ((unsigned long )from == (unsigned long )((void *)0)) { #line 22 tmp = malloc((size_t )sizeof(struct pci_dev )); #line 22 from = (struct pci_dev *)tmp; } #line 25 tmp___0 = nondet_int(); #line 25 if (tmp___0) { #line 26 from->vendor = nondet_ushort(); #line 27 from->device = nondet_ushort(); #line 28 from->irq = nondet_uint(); #line 29 __CPROVER_assume(from->irq < 16U); #line 31 return (from); } else { #line 33 return ((struct pci_dev *)((void *)0)); } } } #line 37 "/usr/local/ddv/models/con2/src/linux/pci.c" __inline int pci_register_driver(struct pci_driver *driver ) { int tmp ; { #line 39 tmp = nondet_int(); #line 39 if (tmp) { #line 40 registered_pci_driver.pci_driver = driver; #line 41 registered_pci_driver.no_pci_device_id = (unsigned int )(sizeof(driver->id_table) / sizeof(struct pci_device_id )); #line 42 registered_pci_driver.dev_initialized = 0; #line 44 return (0); } else { #line 46 return (-1); } } } #line 50 "/usr/local/ddv/models/con2/src/linux/pci.c" __inline void pci_unregister_driver(struct pci_driver *driver ) { { #line 52 registered_pci_driver.pci_driver = (struct pci_driver *)((void *)0); #line 53 registered_pci_driver.no_pci_device_id = 0U; #line 54 return; } } #line 56 "/usr/local/ddv/models/con2/src/linux/pci.c" __inline void pci_release_region(struct pci_dev *pdev , int bar ) { unsigned long tmp ; unsigned long tmp___0 ; unsigned long tmp___1 ; { #line 58 if (pdev->resource[bar].start == 0UL) { #line 58 if (pdev->resource[bar].end == pdev->resource[bar].start) { #line 58 tmp = 0UL; } else { #line 58 tmp = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } } else { #line 58 tmp = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } #line 58 if (tmp == 0UL) { #line 59 return; } #line 60 if (pdev->resource[bar].flags & 256UL) { #line 61 if (pdev->resource[bar].start == 0UL) { #line 61 if (pdev->resource[bar].end == pdev->resource[bar].start) { #line 61 tmp___0 = 0UL; } else { #line 61 tmp___0 = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } } else { #line 61 tmp___0 = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } #line 61 release_region(pdev->resource[bar].start, tmp___0); } else #line 63 if (pdev->resource[bar].flags & 512UL) { #line 64 if (pdev->resource[bar].start == 0UL) { #line 64 if (pdev->resource[bar].end == pdev->resource[bar].start) { #line 64 tmp___1 = 0UL; } else { #line 64 tmp___1 = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } } else { #line 64 tmp___1 = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } #line 64 release_mem_region(pdev->resource[bar].start, tmp___1); } #line 66 return; } } #line 68 "/usr/local/ddv/models/con2/src/linux/pci.c" __inline int pci_request_region(struct pci_dev *pdev , int bar , char const *res_name ) { unsigned long tmp ; unsigned long tmp___0 ; struct resource *tmp___1 ; unsigned long tmp___2 ; struct resource *tmp___3 ; { #line 70 if (pdev->resource[bar].start == 0UL) { #line 70 if (pdev->resource[bar].end == pdev->resource[bar].start) { #line 70 tmp = 0UL; } else { #line 70 tmp = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } } else { #line 70 tmp = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } #line 70 if (tmp == 0UL) { #line 71 return (0); } #line 73 if (pdev->resource[bar].flags & 256UL) { #line 74 if (pdev->resource[bar].start == 0UL) { #line 74 if (pdev->resource[bar].end == pdev->resource[bar].start) { #line 74 tmp___0 = 0UL; } else { #line 74 tmp___0 = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } } else { #line 74 tmp___0 = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } #line 74 tmp___1 = request_region(pdev->resource[bar].start, tmp___0, res_name); #line 74 if (! tmp___1) { #line 76 return (-16); } } else #line 78 if (pdev->resource[bar].flags & 512UL) { #line 79 if (pdev->resource[bar].start == 0UL) { #line 79 if (pdev->resource[bar].end == pdev->resource[bar].start) { #line 79 tmp___2 = 0UL; } else { #line 79 tmp___2 = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } } else { #line 79 tmp___2 = (pdev->resource[bar].end - pdev->resource[bar].start) + 1UL; } #line 79 tmp___3 = request_mem_region(pdev->resource[bar].start, tmp___2, res_name); #line 79 if (! tmp___3) { #line 81 return (-16); } } #line 84 return (0); } } #line 87 "/usr/local/ddv/models/con2/src/linux/pci.c" __inline void pci_release_regions(struct pci_dev *pdev ) { int i ; { #line 91 i = 0; #line 91 while (i < 6) { #line 92 pci_release_region(pdev, i); #line 91 i ++; } #line 93 return; } } #line 95 "/usr/local/ddv/models/con2/src/linux/pci.c" __inline int pci_request_regions(struct pci_dev *pdev , char const *res_name ) { int i ; int tmp ; { #line 99 i = 0; #line 99 while (i < 6) { #line 100 tmp = pci_request_region(pdev, i, res_name); #line 100 if (tmp) { #line 101 goto err_out; } #line 99 i ++; } #line 102 return (0); err_out: #line 105 while (1) { #line 105 i --; #line 105 if (! (i >= 0)) { #line 105 break; } #line 106 pci_release_region(pdev, i); } #line 108 return (-16); } } #line 1 "resource.o" #pragma merger("0","/tmp/cil-VHyhkdJv.i","") #line 21 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" extern unsigned char nondet_uchar() ; #line 22 extern unsigned int nondet_unsigned() ; #line 10 "/usr/local/ddv/models/con2/include/ddverify/ioport.h" int ddv_ioport_request_start ; #line 11 "/usr/local/ddv/models/con2/include/ddverify/ioport.h" int ddv_ioport_request_len ; #line 6 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" struct resource *request_region(unsigned long start , unsigned long len , char const *name ) { struct resource *resource ; void *tmp ; { #line 9 tmp = malloc((size_t )sizeof(struct resource )); #line 9 resource = (struct resource *)tmp; #line 14 ddv_ioport_request_start = (int )start; #line 15 ddv_ioport_request_len = (int )len; #line 17 return (resource); } } #line 20 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" void release_region(unsigned long start , unsigned long len ) { unsigned int i ; { #line 22 i = 0U; #line 28 ddv_ioport_request_start = 0; #line 29 ddv_ioport_request_len = 0; #line 30 return; } } #line 32 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" unsigned char inb(unsigned int port ) { int tmp ; unsigned char tmp___0 ; { #line 35 if (port >= (unsigned int )ddv_ioport_request_start) { #line 35 if (port < (unsigned int )(ddv_ioport_request_start + ddv_ioport_request_len)) { #line 35 tmp = 1; } else { #line 35 tmp = 0; } } else { #line 35 tmp = 0; } #line 35 __CPROVER_assert(tmp, "I/O port is requested"); #line 37 tmp___0 = nondet_uchar(); #line 37 return (tmp___0); } } #line 40 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" void outb(unsigned char byte , unsigned int port ) { int tmp ; { #line 43 if (port >= (unsigned int )ddv_ioport_request_start) { #line 43 if (port < (unsigned int )(ddv_ioport_request_start + ddv_ioport_request_len)) { #line 43 tmp = 1; } else { #line 43 tmp = 0; } } else { #line 43 tmp = 0; } #line 43 __CPROVER_assert(tmp, "I/O port is requested"); #line 44 return; } } #line 46 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" __inline unsigned short inw(unsigned int port ) { int tmp ; unsigned short tmp___0 ; { #line 49 if (port >= (unsigned int )ddv_ioport_request_start) { #line 49 if (port < (unsigned int )(ddv_ioport_request_start + ddv_ioport_request_len)) { #line 49 tmp = 1; } else { #line 49 tmp = 0; } } else { #line 49 tmp = 0; } #line 49 __CPROVER_assert(tmp, "I/O port is requested"); #line 51 tmp___0 = nondet_ushort(); #line 51 return (tmp___0); } } #line 54 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" __inline void outw(unsigned short word , unsigned int port ) { int tmp ; { #line 57 if (port >= (unsigned int )ddv_ioport_request_start) { #line 57 if (port < (unsigned int )(ddv_ioport_request_start + ddv_ioport_request_len)) { #line 57 tmp = 1; } else { #line 57 tmp = 0; } } else { #line 57 tmp = 0; } #line 57 __CPROVER_assert(tmp, "I/O port is requested"); #line 58 return; } } #line 60 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" __inline unsigned int inl(unsigned int port ) { int tmp ; unsigned int tmp___0 ; { #line 63 if (port >= (unsigned int )ddv_ioport_request_start) { #line 63 if (port < (unsigned int )(ddv_ioport_request_start + ddv_ioport_request_len)) { #line 63 tmp = 1; } else { #line 63 tmp = 0; } } else { #line 63 tmp = 0; } #line 63 __CPROVER_assert(tmp, "I/O port is requested"); #line 65 tmp___0 = nondet_unsigned(); #line 65 return (tmp___0); } } #line 68 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" __inline void outl(unsigned int doubleword , unsigned int port ) { int tmp ; { #line 71 if (port >= (unsigned int )ddv_ioport_request_start) { #line 71 if (port < (unsigned int )(ddv_ioport_request_start + ddv_ioport_request_len)) { #line 71 tmp = 1; } else { #line 71 tmp = 0; } } else { #line 71 tmp = 0; } #line 71 __CPROVER_assert(tmp, "I/O port is requested"); #line 72 return; } } #line 74 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" __inline unsigned char inb_p(unsigned int port ) { int tmp ; unsigned char tmp___0 ; { #line 77 if (port >= (unsigned int )ddv_ioport_request_start) { #line 77 if (port < (unsigned int )(ddv_ioport_request_start + ddv_ioport_request_len)) { #line 77 tmp = 1; } else { #line 77 tmp = 0; } } else { #line 77 tmp = 0; } #line 77 __CPROVER_assert(tmp, "I/O port is requested"); #line 79 tmp___0 = nondet_uchar(); #line 79 return (tmp___0); } } #line 82 "/usr/local/ddv/models/con2/src/linux/kernel/resource.c" void outb_p(unsigned char byte , unsigned int port ) { int tmp ; { #line 85 if (port >= (unsigned int )ddv_ioport_request_start) { #line 85 if (port < (unsigned int )(ddv_ioport_request_start + ddv_ioport_request_len)) { #line 85 tmp = 1; } else { #line 85 tmp = 0; } } else { #line 85 tmp = 0; } #line 85 __CPROVER_assert(tmp, "I/O port is requested"); #line 86 return; } } #line 1 "sched.o" #pragma merger("0","/tmp/cil-sgQ76BWD.i","") #line 18 "/usr/local/ddv/models/con2/include/ddverify/satabs.h" extern long nondet_long() ; #line 43 "/usr/local/ddv/models/con2/include/linux/sched.h" void schedule(void) ; #line 45 long schedule_timeout(long timeout ) ; #line 8 "/usr/local/ddv/models/con2/src/linux/kernel/sched.c" void schedule(void) { { #line 10 assert_context_process(); #line 11 return; } } #line 13 "/usr/local/ddv/models/con2/src/linux/kernel/sched.c" long schedule_timeout(long timeout ) { long tmp ; { #line 15 assert_context_process(); #line 17 tmp = nondet_long(); #line 17 return (tmp); } } #line 1 "semaphore.o" #pragma merger("0","/tmp/cil-nUo2xVQB.i","") #line 23 "/usr/local/ddv/models/con2/include/asm/semaphore.h" __inline void sema_init(struct semaphore *sem , int val ) ; #line 25 __inline void init_MUTEX(struct semaphore *sem ) ; #line 27 __inline void init_MUTEX_LOCKED(struct semaphore *sem ) ; #line 29 __inline void down(struct semaphore *sem ) ; #line 31 __inline int down_interruptible(struct semaphore *sem ) ; #line 33 __inline int down_trylock(struct semaphore *sem ) ; #line 35 __inline void up(struct semaphore *sem ) ; #line 6 "/usr/local/ddv/models/con2/src/linux/kernel/semaphore.c" __inline void sema_init(struct semaphore *sem , int val ) { { #line 9 __CPROVER_atomic_begin(); #line 10 sem->init = 1; #line 11 sem->locked = 0; #line 12 __CPROVER_atomic_end(); #line 13 return; } } #line 15 "/usr/local/ddv/models/con2/src/linux/kernel/semaphore.c" __inline void init_MUTEX(struct semaphore *sem ) { { #line 18 __CPROVER_atomic_begin(); #line 19 sem->init = 1; #line 20 sem->locked = 0; #line 21 __CPROVER_atomic_end(); #line 22 return; } } #line 24 "/usr/local/ddv/models/con2/src/linux/kernel/semaphore.c" __inline void init_MUTEX_LOCKED(struct semaphore *sem ) { { #line 27 __CPROVER_atomic_begin(); #line 28 sem->init = 1; #line 29 sem->locked = 1; #line 30 __CPROVER_atomic_end(); #line 31 return; } } #line 33 "/usr/local/ddv/models/con2/src/linux/kernel/semaphore.c" __inline void down(struct semaphore *sem ) { { #line 44 while (1) { #line 46 __CPROVER_atomic_begin(); #line 47 if (sem->locked == 0) { #line 49 sem->locked = 1; #line 50 __CPROVER_atomic_end(); #line 51 return; } #line 53 __CPROVER_atomic_end(); } } } #line 58 "/usr/local/ddv/models/con2/src/linux/kernel/semaphore.c" __inline int down_interruptible(struct semaphore *sem ) { int tmp ; { #line 69 while (1) { #line 71 __CPROVER_atomic_begin(); #line 72 if (sem->locked == 0) { #line 74 sem->locked = 1; #line 75 __CPROVER_atomic_end(); #line 76 return (0); } #line 78 tmp = nondet_int(); #line 78 if (tmp) { #line 79 __CPROVER_atomic_end(); #line 80 return (-1); } #line 83 __CPROVER_atomic_end(); } } } #line 88 "/usr/local/ddv/models/con2/src/linux/kernel/semaphore.c" __inline int down_trylock(struct semaphore *sem ) { { #line 91 __CPROVER_atomic_begin(); #line 97 if (sem->locked == 0) { #line 98 sem->locked = 1; #line 99 __CPROVER_atomic_end(); #line 100 return (-1); } #line 102 __CPROVER_atomic_end(); #line 103 return (0); } } #line 106 "/usr/local/ddv/models/con2/src/linux/kernel/semaphore.c" __inline void up(struct semaphore *sem ) { { #line 109 __CPROVER_atomic_begin(); #line 110 assert_context_process(); #line 114 sem->locked = 0; #line 115 __CPROVER_atomic_end(); #line 116 return; } } #line 1 "slab.o" #pragma merger("0","/tmp/cil-btadhqtK.i","") #line 10 "/usr/local/ddv/models/con2/include/linux/slab.h" void *kmalloc(size_t size , gfp_t flags ) ; #line 12 void *kzalloc(size_t size , gfp_t flags ) ; #line 6 "/usr/local/ddv/models/con2/src/linux/mm/slab.c" void *kmalloc(size_t size , gfp_t flags ) { void *tmp ; { #line 8 if (flags & 16U) { #line 9 assert_context_process(); } #line 12 tmp = malloc(size); #line 12 return (tmp); } } #line 15 "/usr/local/ddv/models/con2/src/linux/mm/slab.c" void *kzalloc(size_t size , gfp_t flags ) { void *tmp ; { #line 17 if (flags & 16U) { #line 18 assert_context_process(); } #line 21 tmp = malloc(size); #line 21 return (tmp); } } #line 1 "softirq.o" #pragma merger("0","/tmp/cil-LUE9ZMdb.i","") #line 50 "/usr/local/ddv/models/con2/include/linux/interrupt.h" __inline void tasklet_schedule(struct tasklet_struct *t ) ; #line 65 __inline void tasklet_init(struct tasklet_struct *t , void (*func)(unsigned long ) , unsigned long data ) ; #line 4 "/usr/local/ddv/models/con2/src/linux/kernel/softirq.c" __inline void tasklet_schedule(struct tasklet_struct *t ) { int i ; int next_free ; { #line 7 next_free = -1; #line 13 i = 0; #line 13 while (i < 10) { #line 14 if ((unsigned long )tasklet_registered[i].tasklet == (unsigned long )((void *)0)) { #line 15 next_free = i; } #line 17 if ((unsigned long )tasklet_registered[i].tasklet == (unsigned long )t) { #line 17 if ((int )tasklet_registered[i].is_running == 0) { #line 19 return; } } #line 13 i ++; } #line 28 tasklet_registered[next_free].tasklet = t; #line 29 tasklet_registered[next_free].is_running = (unsigned short)0; #line 30 return; } } #line 32 "/usr/local/ddv/models/con2/src/linux/kernel/softirq.c" __inline void tasklet_init(struct tasklet_struct *t , void (*func)(unsigned long ) , unsigned long data ) { { #line 36 t->count = 0; #line 37 t->init = 0; #line 38 t->func = func; #line 39 t->data = data; #line 40 return; } } #line 1 "spinlock.o" #pragma merger("0","/tmp/cil-KYhNy3i2.i","") #line 10 "/usr/local/ddv/models/con2/include/linux/spinlock.h" __inline void spin_lock(spinlock_t *lock ) ; #line 11 __inline void spin_lock_irqsave(spinlock_t *lock , unsigned long flags ) ; #line 12 __inline void spin_lock_irq(spinlock_t *lock ) ; #line 13 __inline void spin_lock_bh(spinlock_t *lock ) ; #line 15 __inline void spin_unlock(spinlock_t *lock ) ; #line 16 __inline void spin_unlock_irqrestore(spinlock_t *lock , unsigned long flags ) ; #line 17 __inline void spin_unlock_irq(spinlock_t *lock ) ; #line 18 __inline void spin_unlock_bh(spinlock_t *lock ) ; #line 4 "/usr/local/ddv/models/con2/src/linux/kernel/spinlock.c" void spin_lock_init(spinlock_t *lock ) { { #line 6 lock->init = 1; #line 7 lock->locked = 0; #line 8 return; } } #line 10 "/usr/local/ddv/models/con2/src/linux/kernel/spinlock.c" __inline void spin_lock(spinlock_t *lock ) { { #line 20 while (1) { #line 22 __CPROVER_atomic_begin(); #line 23 if (lock->locked == 0) { #line 25 lock->locked = 1; #line 26 __CPROVER_atomic_end(); #line 27 return; } #line 29 __CPROVER_atomic_end(); } } } #line 34 "/usr/local/ddv/models/con2/src/linux/kernel/spinlock.c" __inline void spin_lock_irqsave(spinlock_t *lock , unsigned long flags ) { { #line 44 while (1) { #line 46 __CPROVER_atomic_begin(); #line 47 if (lock->locked == 0) { #line 49 lock->locked = 1; #line 50 __CPROVER_atomic_end(); #line 51 return; } #line 53 __CPROVER_atomic_end(); } } } #line 106 "/usr/local/ddv/models/con2/src/linux/kernel/spinlock.c" __inline void spin_unlock(spinlock_t *lock ) { { #line 109 __CPROVER_atomic_begin(); #line 113 lock->locked = 0; #line 114 __CPROVER_atomic_end(); #line 115 return; } } #line 117 "/usr/local/ddv/models/con2/src/linux/kernel/spinlock.c" __inline void spin_unlock_irqrestore(spinlock_t *lock , unsigned long flags ) { { #line 120 __CPROVER_atomic_begin(); #line 124 lock->locked = 0; #line 125 __CPROVER_atomic_end(); #line 126 return; } } #line 1 "tasklet.o" #pragma merger("0","/tmp/cil-G4a1nku3.i","") #line 3 "/usr/local/ddv/models/con2/src/ddverify/tasklet.c" void call_tasklet_functions(void) { unsigned int i ; { #line 6 __CPROVER_assume(i < 10U); #line 8 if ((unsigned long )tasklet_registered[i].tasklet != (unsigned long )((void *)0)) { #line 8 if ((tasklet_registered[i].tasklet)->count == 0) { #line 10 tasklet_registered[i].is_running = (unsigned short)1; #line 11 (*((tasklet_registered[i].tasklet)->func))((tasklet_registered[i].tasklet)->data); #line 12 tasklet_registered[i].is_running = (unsigned short)0; #line 13 tasklet_registered[i].tasklet = (struct tasklet_struct *)((void *)0); } } #line 15 return; } } #line 1 "timer.o" #pragma merger("0","/tmp/cil-2RWBF56k.i","") #line 26 "/usr/local/ddv/models/con2/include/linux/timer.h" __inline void init_timer(struct timer_list *timer ) ; #line 27 __inline void add_timer_on(struct timer_list *timer , int cpu ) ; #line 30 __inline int mod_timer(struct timer_list *timer , unsigned long expires ) ; #line 4 "/usr/local/ddv/models/con2/src/linux/kernel/timer.c" __inline void init_timer(struct timer_list *timer ) { { #line 6 if ((int )number_timer_registered < 5) { #line 7 timer->__ddv_active = (short)0; #line 8 timer->__ddv_init = (short)1; #line 9 timer_registered[number_timer_registered].timer = timer; #line 11 number_timer_registered = (short )((int )number_timer_registered + 1); } #line 13 return; } } #line 15 "/usr/local/ddv/models/con2/src/linux/kernel/timer.c" void add_timer(struct timer_list *timer ) { { #line 21 timer->__ddv_active = (short)1; #line 22 return; } } #line 24 "/usr/local/ddv/models/con2/src/linux/kernel/timer.c" __inline void add_timer_on(struct timer_list *timer , int cpu ) { { #line 27 add_timer(timer); #line 28 return; } } #line 30 "/usr/local/ddv/models/con2/src/linux/kernel/timer.c" int del_timer(struct timer_list *timer ) { { #line 32 timer->__ddv_active = (short)0; #line 33 return (0); } } #line 35 "/usr/local/ddv/models/con2/src/linux/kernel/timer.c" __inline int mod_timer(struct timer_list *timer , unsigned long expires ) { { #line 41 timer->expires = expires; #line 42 timer->__ddv_active = (short)1; #line 43 return (0); } } #line 1 "tty_io.o" #pragma merger("0","/tmp/cil-uljdkKJr.i","") #line 97 "/usr/local/ddv/models/con2/include/linux/tty_driver.h" struct tty_driver *alloc_tty_driver(int lines ) ; #line 101 void tty_set_operations(struct tty_driver *driver , struct tty_operations const *op ) ; #line 13 "/usr/local/ddv/models/con2/include/ddverify/tty.h" struct ddv_tty_driver global_tty_driver ; #line 4 "/usr/local/ddv/models/con2/src/linux/drivers/char/tty_io.c" struct tty_driver *alloc_tty_driver(int lines ) { { #line 6 if (! global_tty_driver.allocated) { #line 7 global_tty_driver.driver.magic = 21506; #line 8 global_tty_driver.driver.num = lines; } else { #line 10 return ((struct tty_driver *)((void *)0)); } #line 12 return ((struct tty_driver *)0); } } #line 14 "/usr/local/ddv/models/con2/src/linux/drivers/char/tty_io.c" void tty_set_operations(struct tty_driver *driver , struct tty_operations const *op ) { { #line 17 driver->open = (int (*)(struct tty_struct *tty , struct file *filp ))op->open; #line 18 driver->close = (void (*)(struct tty_struct *tty , struct file *filp ))op->close; #line 19 driver->write = (int (*)(struct tty_struct *tty , unsigned char const *buf , int count ))op->write; #line 20 driver->put_char = (void (*)(struct tty_struct *tty , unsigned char ch ))op->put_char; #line 21 driver->flush_chars = (void (*)(struct tty_struct *tty ))op->flush_chars; #line 22 driver->write_room = (int (*)(struct tty_struct *tty ))op->write_room; #line 23 driver->chars_in_buffer = (int (*)(struct tty_struct *tty ))op->chars_in_buffer; #line 24 driver->ioctl = (int (*)(struct tty_struct *tty , struct file *file , unsigned int cmd , unsigned long arg ))op->ioctl; #line 25 driver->set_termios = (void (*)(struct tty_struct *tty , struct termios *old ))op->set_termios; #line 26 driver->throttle = (void (*)(struct tty_struct *tty ))op->throttle; #line 27 driver->unthrottle = (void (*)(struct tty_struct *tty ))op->unthrottle; #line 28 driver->stop = (void (*)(struct tty_struct *tty ))op->stop; #line 29 driver->start = (void (*)(struct tty_struct *tty ))op->start; #line 30 driver->hangup = (void (*)(struct tty_struct *tty ))op->hangup; #line 31 driver->break_ctl = (void (*)(struct tty_struct *tty , int state ))op->break_ctl; #line 32 driver->flush_buffer = (void (*)(struct tty_struct *tty ))op->flush_buffer; #line 33 driver->set_ldisc = (void (*)(struct tty_struct *tty ))op->set_ldisc; #line 34 driver->wait_until_sent = (void (*)(struct tty_struct *tty , int timeout ))op->wait_until_sent; #line 35 driver->send_xchar = (void (*)(struct tty_struct *tty , char ch ))op->send_xchar; #line 36 driver->read_proc = (int (*)(char *page , char **start , off_t off , int count , int *eof , void *data ))op->read_proc; #line 37 driver->write_proc = (int (*)(struct file *file , char const *buffer , unsigned long count , void *data ))op->write_proc; #line 38 driver->tiocmget = (int (*)(struct tty_struct *tty , struct file *file ))op->tiocmget; #line 39 driver->tiocmset = (int (*)(struct tty_struct *tty , struct file *file , unsigned int set , unsigned int clear ))op->tiocmset; #line 40 return; } } #line 1 "usercopy.o" #pragma merger("0","/tmp/cil-dhkvuzot.i","") #line 41 "/usr/local/ddv/models/con2/include/asm/uaccess.h" __inline int __get_user(int size , void *ptr ) ; #line 43 __inline int get_user(int size , void *ptr ) ; #line 46 __inline int __put_user(int size , void *ptr ) ; #line 48 __inline int put_user(int size , void *ptr ) ; #line 5 "/usr/local/ddv/models/con2/src/linux/arch/i386/lib/usercopy.c" __inline int __get_user(int size , void *ptr ) { int tmp ; { #line 8 assert_context_process(); #line 10 tmp = nondet_int(); #line 10 return (tmp); } } #line 37 "/usr/local/ddv/models/con2/src/linux/arch/i386/lib/usercopy.c" unsigned long copy_to_user(void *to , void const *from , unsigned long n ) { unsigned long tmp ; { #line 40 assert_context_process(); #line 42 tmp = nondet_ulong(); #line 42 return (tmp); } } #line 45 "/usr/local/ddv/models/con2/src/linux/arch/i386/lib/usercopy.c" unsigned long copy_from_user(void *to , void *from , unsigned long n ) { unsigned long tmp ; { #line 48 assert_context_process(); #line 50 tmp = nondet_ulong(); #line 50 return (tmp); } } #line 1 "vmalloc.o" #pragma merger("0","/tmp/cil-__tCq7FV.i","") #line 6 "/usr/local/ddv/models/con2/include/linux/vmalloc.h" void *vmalloc(unsigned long size ) ; #line 6 "/usr/local/ddv/models/con2/src/linux/mm/vmalloc.c" void *vmalloc(unsigned long size ) { void *tmp ; { #line 8 tmp = malloc((size_t )size); #line 8 return (tmp); } } #line 1 "wait.o" #pragma merger("0","/tmp/cil-J1YJQE9v.i","") #line 64 "/usr/local/ddv/models/con2/include/linux/wait.h" __inline void init_waitqueue_head(wait_queue_head_t *q ) ; #line 73 __inline void wake_up_all(wait_queue_head_t *q ) ; #line 75 __inline void wake_up_interruptible(wait_queue_head_t *q ) ; #line 90 __inline void interruptible_sleep_on(wait_queue_head_t *q ) ; #line 3 "/usr/local/ddv/models/con2/src/linux/kernel/wait.c" __inline void init_waitqueue_head(wait_queue_head_t *q ) { { #line 5 q->init = 1; #line 6 return; } } #line 8 "/usr/local/ddv/models/con2/src/linux/kernel/wait.c" void wake_up(wait_queue_head_t *q ) { { #line 14 return; } } #line 16 "/usr/local/ddv/models/con2/src/linux/kernel/wait.c" __inline void wake_up_all(wait_queue_head_t *q ) { { #line 22 return; } } #line 32 "/usr/local/ddv/models/con2/src/linux/kernel/wait.c" void sleep_on(wait_queue_head_t *q ) { { #line 38 return; } } #line 1 "workqueue.o" #pragma merger("0","/tmp/cil-JLr0Sybl.i","") #line 46 "/usr/local/ddv/models/con2/include/linux/workqueue.h" __inline int schedule_work(struct work_struct *work ) ; #line 5 "/usr/local/ddv/models/con2/src/linux/kernel/workqueue.c" __inline int schedule_work(struct work_struct *work ) { int i ; { #line 14 i = 0; #line 14 while (i < 10) { #line 15 if ((unsigned long )shared_workqueue[i] == (unsigned long )work) { #line 16 return (0); } #line 19 if ((unsigned long )shared_workqueue[i] == (unsigned long )((void *)0)) { #line 20 shared_workqueue[i] = work; #line 22 return (1); } #line 14 i ++; } #line 27 return (-1); } } #line 30 "/usr/local/ddv/models/con2/src/linux/kernel/workqueue.c" void call_shared_workqueue_functions(void) { unsigned short i ; unsigned short tmp ; { #line 32 tmp = nondet_ushort(); #line 32 i = tmp; #line 33 __CPROVER_assume((int )i < 10); #line 35 if ((unsigned long )shared_workqueue[i] != (unsigned long )((void *)0)) { #line 36 (*((shared_workqueue[i])->func))((shared_workqueue[i])->data); #line 37 shared_workqueue[i] = (struct work_struct *)((void *)0); } #line 39 return; } }
the_stack_data/7949727.c
#include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> static int usage() { fprintf(stderr,"ln [-s] <target> <name>\n"); return -1; } int ln_main(int argc, char *argv[]) { int symbolic = 0; int ret; if(argc < 2) return usage(); if(!strcmp(argv[1],"-s")) { symbolic = 1; argc--; argv++; } if(argc < 3) return usage(); if(symbolic) { ret = symlink(argv[1], argv[2]); } else { ret = link(argv[1], argv[2]); } if(ret < 0) fprintf(stderr, "link failed %s\n", strerror(errno)); return ret; }
the_stack_data/23575458.c
#include <stdio.h> #include <stdlib.h> #define len 100 int main(int argc, char const *argv[]) { int guess[len] = {0}; int real_burst[len] = {0}; int i = 0; int length = 1; float alpha; do{ int tmp; printf("Please enter real CPU burst time, enter -1 for terminate input: "); scanf("%d", &tmp); if(tmp != -1){ real_burst[length++] = tmp; }else{ break; } }while(1); printf("Please enter the value of alpha: "); scanf("%f", &alpha); printf("Please enter the first value of guessing: "); scanf("%d", &guess[0]); FILE *f = fopen("data_HW5_3_guess.txt", "w"); FILE *f_2 = fopen("data_HW5_3_real.txt", "w"); if (f == NULL || f_2 == NULL) { printf("Error opening file!\n"); exit(1); } for(i = 1; i < length; i++){ guess[i] = alpha * real_burst[i] + (1.0 - alpha) * guess[i-1]; } for(i = 0; i < length; i++){ fprintf(f, "%d %d\n", i, guess[i]); fprintf(f_2, "%d %d\n", i, real_burst[i]); } fclose(f); fclose(f_2); return 0; }
the_stack_data/167331907.c
#include <stdio.h> #include <stdlib.h> #include <assert.h> void mainQ(int flag, int u1) { assert(u1 > 0); int j = 2; int k = 0; int i0 = 0; while (i0 < u1) { i0++; if (flag != 0) j = j + 4; else { j = j + 2; k = k + 1; } } //%%%traces: int j, int k //if (k != 0) assert(j == 2 * k + 2); } int main(int argc, char *argv[]) { mainQ(atoi(argv[1]), atoi(argv[2])); return 0; }
the_stack_data/50998.c
#include <stdio.h> #define MAXLINE 1000 int mygetline(char line[], int maxline); int strindex(char source[], char searchfor[]); char pattern[] = "cake"; /* find all lines matching pattern, searching backwards */ int main() { char line[MAXLINE]; int found = 0; int pos; while (mygetline(line, MAXLINE) > 0) if ((pos = strindex(line, pattern)) >= 0) { printf("(%d)%s", pos, line); found++; } return found; } /* mygetline: get line into s, return length */ int mygetline(char s[], int lim) { int c, i; i = c = 0; while (--lim > 0 && (c=getchar()) != EOF && c != '\n') s[i++] = c; if (c == '\n') s[i++] = c; s[i] = '\0'; return i; } /* strindex: return index of t is s, -1 if none */ int strindex(char s[], char t[]) { int i, j, k; int lens, lent; for (lens=0; s[lens] != '\0'; lens++) ; for (lent=0; t[lent] != '\0'; lent++) ; if (lens < lent) return -1; for (i = lens - lent; s[i] != '\0'; --i) { for (j=i, k=0; t[k]!='\0' && s[j]==t[k]; j++, k++) ; if (k > 0 && t[k] == '\0') return i; } return -1; }
the_stack_data/39052.c
#include <stddef.h> #include <stdint.h> // Auto-generated with make_tests.bat on 15/11/2021 2:25:28.79 /******************************************************************************/ static const uint8_t lzsa_test_01_plain[] = { 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x3f, 0x20, 0x42, 0x6c, 0x61, 0x68, 0x2c, 0x20, 0x62, 0x6c, 0x61, 0x68, 0x2c, 0x20, 0x62, 0x6c, 0x61, 0x68, 0x2e, 0x2e, 0x2e }; // static const size_t lzsa_test_01_plain_len = 51; static const uint8_t lzsa_test_01_lzsa1[] = { 0x73, 0x01, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x68, 0xf9, 0x53, 0x69, 0x73, 0x20, 0x74, 0x68, 0xfb, 0x76, 0x07, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x3f, 0x20, 0x42, 0x6c, 0x61, 0x68, 0x2c, 0x20, 0x62, 0xfa, 0x3f, 0x2e, 0x2e, 0x2e, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_01_lzsa1_len = 43; static const uint8_t lzsa_test_01_lzsa2[] = { 0x1c, 0x5c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x68, 0x1c, 0x2d, 0x69, 0x73, 0x20, 0x74, 0x68, 0x18, 0x80, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x3f, 0x20, 0x42, 0x6c, 0x61, 0x68, 0x2f, 0x62, 0xd0, 0x08, 0x2e, 0xff, 0xe7, 0xe8 }; // static const size_t lzsa_test_01_lzsa2_len = 38; /******************************************************************************/ static const uint8_t lzsa_test_02_plain[] = { 0x46, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x20, 0x69, 0x74, 0x20, 0x77, 0x61, 0x73, 0x20, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x61, 0x20, 0x72, 0x65, 0x6c, 0x69, 0x65, 0x66, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x65, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x73, 0x20, 0x62, 0x65, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x2d, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x2c, 0x20, 0x61, 0x20, 0x73, 0x69, 0x63, 0x6b, 0x6e, 0x65, 0x73, 0x73, 0x20, 0x6d, 0x61, 0x6e, 0x79, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x72, 0x6e, 0x20, 0x6d, 0x6f, 0x76, 0x69, 0x65, 0x73, 0x20, 0x73, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x2e, 0x20, 0x57, 0x68, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x75, 0x6e, 0x20, 0x69, 0x66, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x6f, 0x76, 0x69, 0x65, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x64, 0x6f, 0x6e, 0x27, 0x74, 0x20, 0x74, 0x61, 0x6c, 0x6b, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x69, 0x74, 0x2c, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x20, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x75, 0x70, 0x2c, 0x20, 0x6d, 0x61, 0x79, 0x62, 0x65, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x61, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x6f, 0x6f, 0x6b, 0x3f }; // static const size_t lzsa_test_02_plain_len = 229; static const uint8_t lzsa_test_02_lzsa1[] = { 0x71, 0x39, 0x46, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x20, 0x69, 0x74, 0x20, 0x77, 0x61, 0x73, 0x20, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x61, 0x20, 0x72, 0x65, 0x6c, 0x69, 0x65, 0x66, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x65, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x73, 0x20, 0x62, 0x65, 0xf7, 0x10, 0x6f, 0xec, 0x71, 0x35, 0x2d, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x2c, 0x20, 0x61, 0x20, 0x73, 0x69, 0x63, 0x6b, 0x6e, 0x65, 0x73, 0x73, 0x20, 0x6d, 0x61, 0x6e, 0x79, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x72, 0x6e, 0x20, 0x6d, 0x6f, 0x76, 0x69, 0x65, 0x73, 0x20, 0x73, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x2e, 0x20, 0x57, 0x68, 0x65, 0x72, 0x65, 0xb6, 0x71, 0x09, 0x74, 0x68, 0x65, 0x20, 0x66, 0x75, 0x6e, 0x20, 0x69, 0x66, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0xef, 0x03, 0xce, 0x72, 0x18, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x64, 0x6f, 0x6e, 0x27, 0x74, 0x20, 0x74, 0x61, 0x6c, 0x6b, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x69, 0x74, 0x2c, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x20, 0x74, 0x50, 0x73, 0x20, 0x75, 0x70, 0x2c, 0x93, 0x31, 0x79, 0x62, 0x65, 0x5e, 0x10, 0x6e, 0x42, 0x22, 0x61, 0x64, 0xbd, 0x10, 0x62, 0xdc, 0x1f, 0x3f, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_02_lzsa1_len = 216; static const uint8_t lzsa_test_02_lzsa2[] = { 0x18, 0xfc, 0x14, 0x46, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x20, 0x69, 0x74, 0x20, 0x77, 0x61, 0x73, 0x20, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x61, 0x20, 0x72, 0x65, 0x6c, 0x69, 0x65, 0x66, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x65, 0x65, 0x50, 0x68, 0x61, 0xde, 0x30, 0x6e, 0x6f, 0xed, 0x1a, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x73, 0x20, 0x62, 0x65, 0xb6, 0x29, 0x6f, 0x59, 0x81, 0x2d, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x2c, 0xc3, 0x18, 0x73, 0x69, 0x63, 0x6b, 0xa5, 0x48, 0x73, 0xdf, 0xf8, 0x6d, 0x61, 0x6e, 0x79, 0x20, 0x6d, 0x6f, 0x64, 0x09, 0x6e, 0xc6, 0x30, 0x76, 0x69, 0x20, 0x2b, 0x38, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x2e, 0x20, 0x57, 0x68, 0x3b, 0x4a, 0x65, 0xb6, 0x08, 0x74, 0x00, 0x6a, 0x10, 0x75, 0x6e, 0x48, 0x66, 0x7b, 0x30, 0x66, 0x74, 0x07, 0x02, 0x44, 0xce, 0x38, 0x76, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x64, 0x6f, 0x6e, 0x27, 0x74, 0x40, 0x64, 0x08, 0x6b, 0x08, 0x28, 0x62, 0x49, 0x74, 0x4f, 0x18, 0x28, 0x2c, 0x20, 0x6c, 0x6f, 0x6f, 0x43, 0x74, 0x59, 0x2f, 0x73, 0x20, 0x75, 0x70, 0x2c, 0x93, 0x48, 0x79, 0x6f, 0x42, 0x5e, 0x49, 0x6e, 0x42, 0x53, 0x61, 0x64, 0xac, 0x49, 0x62, 0xdc, 0xef, 0x3f, 0xe8 }; // static const size_t lzsa_test_02_lzsa2_len = 202; /******************************************************************************/ static const uint8_t lzsa_test_03_plain[] = { 0x54, 0x68, 0x65, 0x20, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x20, 0x64, 0x72, 0x69, 0x76, 0x65, 0x20, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x49, 0x53, 0x41, 0x20, 0x6d, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x76, 0x61, 0x72, 0x79, 0x20, 0x67, 0x72, 0x65, 0x61, 0x74, 0x6c, 0x79, 0x2e, 0x0d, 0x0a, 0x54, 0x68, 0x65, 0x20, 0x49, 0x45, 0x45, 0x45, 0x20, 0x50, 0x39, 0x39, 0x36, 0x20, 0x73, 0x70, 0x65, 0x63, 0x73, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x67, 0x75, 0x69, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x3a, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x2b, 0x31, 0x32, 0x56, 0x20, 0x61, 0x74, 0x20, 0x31, 0x2e, 0x35, 0x41, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x2d, 0x31, 0x32, 0x56, 0x20, 0x61, 0x74, 0x20, 0x30, 0x2e, 0x33, 0x41, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2b, 0x35, 0x56, 0x20, 0x61, 0x74, 0x20, 0x34, 0x2e, 0x35, 0x41, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x35, 0x56, 0x20, 0x61, 0x74, 0x20, 0x30, 0x2e, 0x32, 0x41 }; // static const size_t lzsa_test_03_plain_len = 185; static const uint8_t lzsa_test_03_lzsa1[] = { 0x71, 0x3e, 0x54, 0x68, 0x65, 0x20, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x20, 0x64, 0x72, 0x69, 0x76, 0x65, 0x20, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x49, 0x53, 0x41, 0x20, 0x6d, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x76, 0x61, 0x72, 0x79, 0x20, 0x67, 0x72, 0x65, 0x61, 0x74, 0x6c, 0x79, 0x2e, 0x0d, 0x0a, 0xbb, 0x70, 0x0c, 0x49, 0x45, 0x45, 0x45, 0x20, 0x50, 0x39, 0x39, 0x36, 0x20, 0x73, 0x70, 0x65, 0x63, 0x73, 0x20, 0x31, 0x2e, 0x30, 0xc1, 0x50, 0x66, 0x65, 0x72, 0x73, 0x20, 0xc3, 0x70, 0x13, 0x73, 0x65, 0x20, 0x67, 0x75, 0x69, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x3a, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x2b, 0x31, 0x32, 0x56, 0x20, 0x61, 0x74, 0xd7, 0x22, 0x35, 0x41, 0xef, 0x14, 0x2d, 0xef, 0x33, 0x30, 0x2e, 0x33, 0xef, 0x32, 0x20, 0x2b, 0x35, 0xef, 0x15, 0x34, 0xde, 0x34, 0x20, 0x2d, 0x35, 0xde, 0x2f, 0x32, 0x41, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_03_lzsa1_len = 162; static const uint8_t lzsa_test_03_lzsa2[] = { 0x59, 0xfe, 0x1f, 0x54, 0x68, 0x65, 0x20, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x20, 0x64, 0x72, 0x69, 0x76, 0x65, 0x20, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x49, 0x53, 0x41, 0x20, 0x6d, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0xdf, 0x5a, 0x6e, 0x20, 0x76, 0x61, 0x72, 0x79, 0x20, 0x67, 0x72, 0x65, 0x61, 0x74, 0x6c, 0x79, 0x2e, 0x0d, 0x0a, 0xbb, 0x10, 0x49, 0x45, 0xfc, 0x59, 0x20, 0x50, 0x39, 0x39, 0x36, 0x20, 0x73, 0x70, 0x65, 0x63, 0x73, 0x20, 0x31, 0x2e, 0x30, 0xc1, 0x48, 0x66, 0xc9, 0x00, 0xa8, 0x41, 0xc3, 0x38, 0x73, 0x65, 0x20, 0x67, 0x75, 0x69, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0xaf, 0x48, 0x3a, 0xce, 0x08, 0x20, 0x59, 0x47, 0x2b, 0x31, 0x32, 0x56, 0x20, 0x61, 0x74, 0xd7, 0x13, 0x35, 0x41, 0xed, 0x2d, 0xfa, 0x00, 0x30, 0x2e, 0x33, 0x42, 0xdd, 0x4b, 0x35, 0xde, 0xee, 0x34, 0xfd, 0x20, 0x2d, 0x35, 0xf7, 0x32, 0x41, 0xf0, 0xe8 }; // static const size_t lzsa_test_03_lzsa2_len = 154; /******************************************************************************/ static const uint8_t lzsa_test_04_plain[] = { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43 }; // static const size_t lzsa_test_04_plain_len = 240; static const uint8_t lzsa_test_04_lzsa1[] = { 0x1f, 0x41, 0xff, 0x5d, 0x1f, 0x42, 0xff, 0x5d, 0x1c, 0x43, 0xff, 0x0f, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_04_lzsa1_len = 16; static const uint8_t lzsa_test_04_lzsa2[] = { 0x0f, 0x41, 0xff, 0x57, 0xef, 0x42, 0xf6, 0x57, 0xef, 0x43, 0xe7, 0xf0, 0xe8 }; // static const size_t lzsa_test_04_lzsa2_len = 13; /******************************************************************************/ static const uint8_t lzsa_test_05_plain[] = { 0x4a, 0x35, 0x72, 0x38, 0x4b, 0x41, 0x44, 0x42, 0x31, 0x53, 0x5a, 0x49, 0x79, 0x35, 0x70, 0x4e, 0x44, 0x69, 0x53, 0x52, 0x6a, 0x4a, 0x4c, 0x43, 0x6d, 0x58, 0x44, 0x35, 0x6e, 0x4a, 0x47, 0x35, 0x5a, 0x65, 0x62, 0x76, 0x70, 0x58, 0x51, 0x70, 0x37, 0x67, 0x63, 0x72, 0x6a, 0x6d, 0x69, 0x31, 0x48, 0x6b, 0x49, 0x4e, 0x30, 0x55, 0x34, 0x73, 0x37, 0x78, 0x41, 0x55, 0x59, 0x66, 0x30, 0x34, 0x6a, 0x66, 0x63, 0x66, 0x58, 0x6a, 0x61, 0x68, 0x32, 0x52, 0x6e, 0x37, 0x4d, 0x5a, 0x48, 0x42, 0x45, 0x69, 0x39, 0x68, 0x4c, 0x57, 0x61, 0x43, 0x56, 0x71, 0x79, 0x44, 0x34, 0x59, 0x4d, 0x43, 0x4c, 0x33, 0x56, 0x42, 0x6e, 0x71, 0x68, 0x4c, 0x64, 0x53, 0x42, 0x49, 0x32, 0x76, 0x74, 0x6f, 0x45, 0x56, 0x33, 0x55, 0x39, 0x6a, 0x58, 0x71, 0x52, 0x65, 0x4f, 0x65, 0x75, 0x4d, 0x4a, 0x33, 0x30, 0x61, 0x70, 0x51, 0x41, 0x61, 0x6f, 0x46, 0x36, 0x4a, 0x4e, 0x30, 0x51, 0x6d, 0x62, 0x39, 0x32, 0x4d, 0x50, 0x4b, 0x4a, 0x6b, 0x69, 0x75, 0x62, 0x46, 0x65, 0x4e, 0x58, 0x66, 0x70, 0x64, 0x6e, 0x34, 0x78, 0x63, 0x71, 0x6a, 0x72, 0x38, 0x72, 0x30, 0x30, 0x49, 0x79, 0x34, 0x56, 0x36, 0x65, 0x45, 0x64, 0x4d, 0x47, 0x4b, 0x4e, 0x4f, 0x56, 0x42, 0x4d, 0x4d, 0x70, 0x63, 0x6f, 0x64 }; // static const size_t lzsa_test_05_plain_len = 192; static const uint8_t lzsa_test_05_lzsa1[] = { 0x7f, 0xb9, 0x4a, 0x35, 0x72, 0x38, 0x4b, 0x41, 0x44, 0x42, 0x31, 0x53, 0x5a, 0x49, 0x79, 0x35, 0x70, 0x4e, 0x44, 0x69, 0x53, 0x52, 0x6a, 0x4a, 0x4c, 0x43, 0x6d, 0x58, 0x44, 0x35, 0x6e, 0x4a, 0x47, 0x35, 0x5a, 0x65, 0x62, 0x76, 0x70, 0x58, 0x51, 0x70, 0x37, 0x67, 0x63, 0x72, 0x6a, 0x6d, 0x69, 0x31, 0x48, 0x6b, 0x49, 0x4e, 0x30, 0x55, 0x34, 0x73, 0x37, 0x78, 0x41, 0x55, 0x59, 0x66, 0x30, 0x34, 0x6a, 0x66, 0x63, 0x66, 0x58, 0x6a, 0x61, 0x68, 0x32, 0x52, 0x6e, 0x37, 0x4d, 0x5a, 0x48, 0x42, 0x45, 0x69, 0x39, 0x68, 0x4c, 0x57, 0x61, 0x43, 0x56, 0x71, 0x79, 0x44, 0x34, 0x59, 0x4d, 0x43, 0x4c, 0x33, 0x56, 0x42, 0x6e, 0x71, 0x68, 0x4c, 0x64, 0x53, 0x42, 0x49, 0x32, 0x76, 0x74, 0x6f, 0x45, 0x56, 0x33, 0x55, 0x39, 0x6a, 0x58, 0x71, 0x52, 0x65, 0x4f, 0x65, 0x75, 0x4d, 0x4a, 0x33, 0x30, 0x61, 0x70, 0x51, 0x41, 0x61, 0x6f, 0x46, 0x36, 0x4a, 0x4e, 0x30, 0x51, 0x6d, 0x62, 0x39, 0x32, 0x4d, 0x50, 0x4b, 0x4a, 0x6b, 0x69, 0x75, 0x62, 0x46, 0x65, 0x4e, 0x58, 0x66, 0x70, 0x64, 0x6e, 0x34, 0x78, 0x63, 0x71, 0x6a, 0x72, 0x38, 0x72, 0x30, 0x30, 0x49, 0x79, 0x34, 0x56, 0x36, 0x65, 0x45, 0x64, 0x4d, 0x47, 0x4b, 0x4e, 0x4f, 0x56, 0x42, 0x4d, 0x4d, 0x70, 0x63, 0x6f, 0x64, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_05_lzsa1_len = 198; static const uint8_t lzsa_test_05_lzsa2[] = { 0xff, 0xff, 0xae, 0x4a, 0x35, 0x72, 0x38, 0x4b, 0x41, 0x44, 0x42, 0x31, 0x53, 0x5a, 0x49, 0x79, 0x35, 0x70, 0x4e, 0x44, 0x69, 0x53, 0x52, 0x6a, 0x4a, 0x4c, 0x43, 0x6d, 0x58, 0x44, 0x35, 0x6e, 0x4a, 0x47, 0x35, 0x5a, 0x65, 0x62, 0x76, 0x70, 0x58, 0x51, 0x70, 0x37, 0x67, 0x63, 0x72, 0x6a, 0x6d, 0x69, 0x31, 0x48, 0x6b, 0x49, 0x4e, 0x30, 0x55, 0x34, 0x73, 0x37, 0x78, 0x41, 0x55, 0x59, 0x66, 0x30, 0x34, 0x6a, 0x66, 0x63, 0x66, 0x58, 0x6a, 0x61, 0x68, 0x32, 0x52, 0x6e, 0x37, 0x4d, 0x5a, 0x48, 0x42, 0x45, 0x69, 0x39, 0x68, 0x4c, 0x57, 0x61, 0x43, 0x56, 0x71, 0x79, 0x44, 0x34, 0x59, 0x4d, 0x43, 0x4c, 0x33, 0x56, 0x42, 0x6e, 0x71, 0x68, 0x4c, 0x64, 0x53, 0x42, 0x49, 0x32, 0x76, 0x74, 0x6f, 0x45, 0x56, 0x33, 0x55, 0x39, 0x6a, 0x58, 0x71, 0x52, 0x65, 0x4f, 0x65, 0x75, 0x4d, 0x4a, 0x33, 0x30, 0x61, 0x70, 0x51, 0x41, 0x61, 0x6f, 0x46, 0x36, 0x4a, 0x4e, 0x30, 0x51, 0x6d, 0x62, 0x39, 0x32, 0x4d, 0x50, 0x4b, 0x4a, 0x6b, 0x69, 0x75, 0x62, 0x46, 0x65, 0x4e, 0x58, 0x66, 0x70, 0x64, 0x6e, 0x34, 0x78, 0x63, 0x71, 0x6a, 0x72, 0x38, 0x72, 0x30, 0x30, 0x49, 0x79, 0x34, 0x56, 0x36, 0x65, 0x45, 0x64, 0x4d, 0x47, 0x4b, 0x4e, 0x4f, 0x56, 0x42, 0x4d, 0x4d, 0x70, 0x63, 0x6f, 0x64, 0xe8 }; // static const size_t lzsa_test_05_lzsa2_len = 196; /******************************************************************************/ static const uint8_t lzsa_test_06_plain[] = { 0x31, 0x69, 0x6a, 0x5a, 0x55, 0x63, 0x36, 0x32, 0x69, 0x67, 0x64, 0x56, 0x6e, 0x67, 0x6f, 0x75, 0x64, 0x37, 0x64, 0x4b, 0x47, 0x76, 0x39, 0x36, 0x6e, 0x55, 0x37, 0x34, 0x35, 0x37, 0x62, 0x4e, 0x4f, 0x56, 0x74, 0x42, 0x67, 0x7a, 0x4a, 0x62, 0x70, 0x65, 0x6c, 0x4e, 0x43, 0x6b, 0x78, 0x72, 0x55, 0x75, 0x36, 0x6f, 0x58, 0x61, 0x42, 0x74, 0x43, 0x4d, 0x42, 0x39, 0x74, 0x43, 0x43, 0x67, 0x36, 0x4e, 0x78, 0x4c, 0x71, 0x53, 0x41, 0x68, 0x49, 0x76, 0x78, 0x69, 0x58, 0x68, 0x45, 0x53, 0x73, 0x7a, 0x34, 0x62, 0x57, 0x36, 0x6e, 0x79, 0x4a, 0x53, 0x43, 0x6c, 0x75, 0x53, 0x32, 0x6e, 0x56, 0x4c, 0x72, 0x31, 0x34, 0x6b, 0x4c, 0x4e, 0x54, 0x7a, 0x58, 0x32, 0x5a, 0x59, 0x69, 0x6c, 0x59, 0x46, 0x61, 0x4a, 0x61, 0x55, 0x4d, 0x75, 0x50, 0x4c, 0x45, 0x78, 0x77, 0x43, 0x6d, 0x39, 0x75, 0x66, 0x56, 0x71, 0x74, 0x43, 0x67, 0x51, 0x46, 0x55, 0x37, 0x49, 0x38, 0x65, 0x69, 0x69, 0x6b, 0x65, 0x34, 0x52, 0x38, 0x46, 0x57, 0x4a, 0x4f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x75, 0x33, 0x59, 0x54, 0x6f, 0x33, 0x67, 0x65, 0x42, 0x4a, 0x78, 0x4e, 0x32, 0x47, 0x47, 0x5a, 0x6b, 0x65, 0x4b, 0x79, 0x65, 0x52, 0x34, 0x78, 0x6a, 0x68, 0x72, 0x77, 0x36, 0x69, 0x36, 0x66, 0x6e, 0x6a, 0x68, 0x4e, 0x34, 0x76, 0x64, 0x45, 0x69, 0x6d, 0x45, 0x4b, 0x76, 0x36, 0x51, 0x54, 0x78, 0x79, 0x4f, 0x36, 0x6f, 0x75, 0x68, 0x49, 0x41, 0x6f, 0x39, 0x7a, 0x41, 0x31, 0x7a, 0x70, 0x49, 0x43, 0x57, 0x62, 0x78, 0x56, 0x6b, 0x52, 0x4d, 0x58, 0x35, 0x50, 0x32, 0x4e, 0x32, 0x4f, 0x36, 0x77, 0x56, 0x73, 0x39, 0x6f, 0x71, 0x47, 0x4d, 0x38, 0x6c, 0x52, 0x41, 0x6e, 0x4e, 0x4d, 0x54, 0x51, 0x63, 0x62, 0x53, 0x36, 0x34, 0x34, 0x54, 0x76, 0x49, 0x41, 0x30, 0x42, 0x57, 0x45, 0x31, 0x64, 0x33, 0x52, 0x59, 0x58, 0x4f, 0x50, 0x67, 0x6c, 0x52, 0x66, 0x4d, 0x47, 0x70, 0x34, 0x4d, 0x72, 0x6f, 0x4d, 0x44, 0x65, 0x33, 0x37, 0x6e, 0x5a, 0x51, 0x57, 0x54, 0x31, 0x4f, 0x43, 0x61, 0x65 }; // static const size_t lzsa_test_06_plain_len = 304; static const uint8_t lzsa_test_06_lzsa1[] = { 0x7f, 0xfa, 0x30, 0x31, 0x69, 0x6a, 0x5a, 0x55, 0x63, 0x36, 0x32, 0x69, 0x67, 0x64, 0x56, 0x6e, 0x67, 0x6f, 0x75, 0x64, 0x37, 0x64, 0x4b, 0x47, 0x76, 0x39, 0x36, 0x6e, 0x55, 0x37, 0x34, 0x35, 0x37, 0x62, 0x4e, 0x4f, 0x56, 0x74, 0x42, 0x67, 0x7a, 0x4a, 0x62, 0x70, 0x65, 0x6c, 0x4e, 0x43, 0x6b, 0x78, 0x72, 0x55, 0x75, 0x36, 0x6f, 0x58, 0x61, 0x42, 0x74, 0x43, 0x4d, 0x42, 0x39, 0x74, 0x43, 0x43, 0x67, 0x36, 0x4e, 0x78, 0x4c, 0x71, 0x53, 0x41, 0x68, 0x49, 0x76, 0x78, 0x69, 0x58, 0x68, 0x45, 0x53, 0x73, 0x7a, 0x34, 0x62, 0x57, 0x36, 0x6e, 0x79, 0x4a, 0x53, 0x43, 0x6c, 0x75, 0x53, 0x32, 0x6e, 0x56, 0x4c, 0x72, 0x31, 0x34, 0x6b, 0x4c, 0x4e, 0x54, 0x7a, 0x58, 0x32, 0x5a, 0x59, 0x69, 0x6c, 0x59, 0x46, 0x61, 0x4a, 0x61, 0x55, 0x4d, 0x75, 0x50, 0x4c, 0x45, 0x78, 0x77, 0x43, 0x6d, 0x39, 0x75, 0x66, 0x56, 0x71, 0x74, 0x43, 0x67, 0x51, 0x46, 0x55, 0x37, 0x49, 0x38, 0x65, 0x69, 0x69, 0x6b, 0x65, 0x34, 0x52, 0x38, 0x46, 0x57, 0x4a, 0x4f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x75, 0x33, 0x59, 0x54, 0x6f, 0x33, 0x67, 0x65, 0x42, 0x4a, 0x78, 0x4e, 0x32, 0x47, 0x47, 0x5a, 0x6b, 0x65, 0x4b, 0x79, 0x65, 0x52, 0x34, 0x78, 0x6a, 0x68, 0x72, 0x77, 0x36, 0x69, 0x36, 0x66, 0x6e, 0x6a, 0x68, 0x4e, 0x34, 0x76, 0x64, 0x45, 0x69, 0x6d, 0x45, 0x4b, 0x76, 0x36, 0x51, 0x54, 0x78, 0x79, 0x4f, 0x36, 0x6f, 0x75, 0x68, 0x49, 0x41, 0x6f, 0x39, 0x7a, 0x41, 0x31, 0x7a, 0x70, 0x49, 0x43, 0x57, 0x62, 0x78, 0x56, 0x6b, 0x52, 0x4d, 0x58, 0x35, 0x50, 0x32, 0x4e, 0x32, 0x4f, 0x36, 0x77, 0x56, 0x73, 0x39, 0x6f, 0x71, 0x47, 0x4d, 0x38, 0x6c, 0x52, 0x41, 0x6e, 0x4e, 0x4d, 0x54, 0x51, 0x63, 0x62, 0x53, 0x36, 0x34, 0x34, 0x54, 0x76, 0x49, 0x41, 0x30, 0x42, 0x57, 0x45, 0x31, 0x64, 0x33, 0x52, 0x59, 0x58, 0x4f, 0x50, 0x67, 0x6c, 0x52, 0x66, 0x4d, 0x47, 0x70, 0x34, 0x4d, 0x72, 0x6f, 0x4d, 0x44, 0x65, 0x33, 0x37, 0x6e, 0x5a, 0x51, 0x57, 0x54, 0x31, 0x4f, 0x43, 0x61, 0x65, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_06_lzsa1_len = 311; static const uint8_t lzsa_test_06_lzsa2[] = { 0x18, 0xf1, 0xdb, 0x31, 0x69, 0x6a, 0x5a, 0x55, 0x63, 0x36, 0x32, 0x69, 0x67, 0x64, 0x56, 0x6e, 0x67, 0x6f, 0x75, 0x64, 0x37, 0x64, 0x4b, 0x47, 0x76, 0x39, 0x36, 0x6e, 0x55, 0x37, 0x34, 0x35, 0x37, 0x62, 0x4e, 0x4f, 0x56, 0x74, 0x42, 0x67, 0x7a, 0x4a, 0x62, 0x70, 0x65, 0x6c, 0x4e, 0x43, 0x6b, 0x78, 0x72, 0x55, 0x75, 0x36, 0x6f, 0x58, 0x61, 0x42, 0x74, 0x43, 0x4d, 0x42, 0x39, 0x74, 0x43, 0x43, 0x67, 0x36, 0x4e, 0x78, 0x4c, 0x71, 0x53, 0x41, 0x68, 0x49, 0x76, 0x78, 0x69, 0x58, 0x68, 0x45, 0x53, 0x73, 0x7a, 0x34, 0x62, 0x57, 0x36, 0x6e, 0x79, 0x4a, 0x53, 0x43, 0x6c, 0x75, 0x53, 0x32, 0x6e, 0x56, 0x4c, 0x72, 0x31, 0x34, 0x6b, 0x4c, 0x4e, 0x54, 0x7a, 0x58, 0x32, 0x5a, 0x59, 0x69, 0x6c, 0x59, 0x46, 0x61, 0x4a, 0x61, 0x55, 0x4d, 0x75, 0x50, 0x4c, 0x45, 0x78, 0x77, 0x43, 0x6d, 0x39, 0x75, 0x66, 0x56, 0x71, 0x74, 0x43, 0x67, 0x51, 0x46, 0x55, 0x37, 0x49, 0x38, 0x65, 0x69, 0x69, 0x6b, 0x65, 0x34, 0x52, 0x38, 0x46, 0x57, 0x4a, 0x4f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x75, 0x33, 0x59, 0x54, 0x6f, 0x33, 0x67, 0x65, 0x42, 0x4a, 0x78, 0x4e, 0x32, 0x47, 0x47, 0x5a, 0x6b, 0x65, 0x4b, 0x79, 0x65, 0x52, 0x34, 0x78, 0x6a, 0x68, 0x72, 0x77, 0x36, 0x69, 0x36, 0x66, 0x6e, 0x6a, 0x68, 0x4e, 0x34, 0x76, 0x64, 0x45, 0x69, 0x6d, 0x45, 0x4b, 0x76, 0x36, 0x51, 0x54, 0x78, 0x79, 0x4f, 0x36, 0x6f, 0x75, 0x68, 0x49, 0x41, 0x6f, 0x39, 0x7a, 0x41, 0x31, 0x7a, 0x70, 0x49, 0x43, 0x57, 0x62, 0x78, 0x56, 0x6b, 0x52, 0x4d, 0x58, 0x35, 0x50, 0x32, 0x4e, 0x32, 0xff, 0xff, 0x2f, 0x77, 0x56, 0x73, 0x39, 0x6f, 0x71, 0x47, 0x4d, 0x38, 0x6c, 0x52, 0x41, 0x6e, 0x4e, 0x4d, 0x54, 0x51, 0x63, 0x62, 0x53, 0x36, 0x34, 0x34, 0x54, 0x76, 0x49, 0x41, 0x30, 0x42, 0x57, 0x45, 0x31, 0x64, 0x33, 0x52, 0x59, 0x58, 0x4f, 0x50, 0x67, 0x6c, 0x52, 0x66, 0x4d, 0x47, 0x70, 0x34, 0x4d, 0x72, 0x6f, 0x4d, 0x44, 0x65, 0x33, 0x37, 0x6e, 0x5a, 0x51, 0x57, 0x54, 0x31, 0x4f, 0x43, 0x61, 0x65, 0xe8 }; // static const size_t lzsa_test_06_lzsa2_len = 309; /******************************************************************************/ static const uint8_t lzsa_test_07_plain[] = { 0x31, 0x69, 0x6a, 0x5a, 0x55, 0x63, 0x36, 0x32, 0x69, 0x67, 0x64, 0x56, 0x6e, 0x67, 0x6f, 0x75, 0x64, 0x37, 0x64, 0x4b, 0x47, 0x76, 0x39, 0x36, 0x6e, 0x55, 0x37, 0x34, 0x35, 0x37, 0x62, 0x4e, 0x4f, 0x56, 0x74, 0x42, 0x67, 0x7a, 0x4a, 0x62, 0x70, 0x65, 0x6c, 0x4e, 0x43, 0x6b, 0x78, 0x72, 0x55, 0x75, 0x36, 0x6f, 0x58, 0x61, 0x42, 0x74, 0x43, 0x4d, 0x42, 0x39, 0x74, 0x43, 0x43, 0x67, 0x36, 0x4e, 0x78, 0x4c, 0x71, 0x53, 0x41, 0x68, 0x49, 0x76, 0x78, 0x69, 0x58, 0x68, 0x45, 0x53, 0x73, 0x7a, 0x34, 0x62, 0x57, 0x36, 0x6e, 0x79, 0x4a, 0x53, 0x43, 0x6c, 0x75, 0x53, 0x32, 0x6e, 0x56, 0x4c, 0x72, 0x31, 0x34, 0x6b, 0x4c, 0x4e, 0x54, 0x7a, 0x58, 0x32, 0x5a, 0x59, 0x69, 0x6c, 0x59, 0x46, 0x61, 0x4a, 0x61, 0x55, 0x4d, 0x75, 0x50, 0x4c, 0x45, 0x78, 0x77, 0x43, 0x6d, 0x39, 0x75, 0x66, 0x56, 0x71, 0x74, 0x43, 0x67, 0x51, 0x46, 0x55, 0x37, 0x49, 0x38, 0x65, 0x69, 0x69, 0x6b, 0x65, 0x34, 0x52, 0x38, 0x46, 0x57, 0x4a, 0x4f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x75, 0x33, 0x59, 0x54, 0x6f, 0x33, 0x67, 0x65, 0x42, 0x4a, 0x78, 0x4e, 0x32, 0x47, 0x47, 0x5a, 0x6b, 0x65, 0x4b, 0x79, 0x65, 0x52, 0x34, 0x78, 0x6a, 0x68, 0x72, 0x77, 0x36, 0x69, 0x36, 0x66, 0x6e, 0x6a, 0x68, 0x4e, 0x34, 0x76, 0x64, 0x45, 0x69, 0x6d, 0x45, 0x4b, 0x76, 0x36, 0x51, 0x54, 0x78, 0x79, 0x4f, 0x36, 0x6f, 0x75, 0x68, 0x49, 0x41, 0x6f, 0x39, 0x7a, 0x41, 0x31, 0x7a, 0x70, 0x49, 0x43, 0x57, 0x62, 0x78, 0x56, 0x6b, 0x52, 0x4d, 0x58, 0x35, 0x50, 0x32, 0x4e, 0x32, 0x4f, 0x36, 0x77, 0x56, 0x73, 0x39, 0x6f, 0x71, 0x47, 0x4d, 0x38, 0x6c, 0x52, 0x41, 0x6e, 0x4e, 0x4d, 0x54, 0x51, 0x63, 0x62, 0x53, 0x36, 0x34, 0x34, 0x54, 0x76, 0x49, 0x41, 0x30, 0x42, 0x57, 0x45, 0x31, 0x64, 0x33, 0x52, 0x59, 0x58, 0x4f, 0x50, 0x67, 0x6c, 0x52, 0x66, 0x4d, 0x47, 0x70, 0x34, 0x4d, 0x72, 0x6f, 0x4d, 0x44, 0x65, 0x33, 0x37, 0x6e, 0x5a, 0x51, 0x57, 0x54, 0x31, 0x4f, 0x43, 0x61, 0x65, 0x4a, 0x43, 0x69, 0x65, 0x45, 0x6a, 0x53, 0x78, 0x49, 0x6f, 0x4e, 0x4d, 0x6c, 0x70, 0x51, 0x72, 0x54, 0x4e, 0x6d, 0x48, 0x7a, 0x49, 0x44, 0x70, 0x6a, 0x45, 0x73, 0x49, 0x73, 0x48, 0x6b, 0x66, 0x36, 0x65, 0x6e, 0x35, 0x4d, 0x48, 0x6d, 0x65, 0x72, 0x59, 0x79, 0x6c, 0x42, 0x52, 0x41, 0x76, 0x71, 0x45, 0x48, 0x52, 0x71, 0x4c, 0x66, 0x41, 0x46, 0x56, 0x67, 0x6c, 0x41, 0x6e, 0x33, 0x4e, 0x47, 0x6f, 0x68, 0x35, 0x38, 0x68, 0x31, 0x61, 0x30, 0x5a, 0x64, 0x73, 0x4d, 0x6d, 0x65, 0x58, 0x64, 0x68, 0x6c, 0x6d, 0x74, 0x46, 0x32, 0x4d, 0x44, 0x47, 0x45, 0x41, 0x45, 0x70, 0x74, 0x56, 0x42, 0x67, 0x6d, 0x6b, 0x75, 0x6e, 0x62, 0x61, 0x36, 0x36, 0x5a, 0x32, 0x39, 0x49, 0x55, 0x55, 0x50, 0x69, 0x62, 0x72, 0x33, 0x36, 0x51, 0x30, 0x49, 0x61, 0x36, 0x39, 0x37, 0x5a, 0x69, 0x44, 0x37, 0x63, 0x7a, 0x47, 0x61, 0x37, 0x41, 0x73, 0x77, 0x55, 0x42, 0x42, 0x64, 0x50, 0x76, 0x44, 0x39, 0x31, 0x78, 0x47, 0x32, 0x6b, 0x56, 0x75, 0x57, 0x58, 0x75, 0x31, 0x59, 0x6d, 0x67, 0x61, 0x46, 0x78, 0x4d, 0x42, 0x35, 0x6a, 0x37, 0x78, 0x4c, 0x39, 0x51, 0x5a, 0x4d, 0x73, 0x59, 0x4c, 0x42, 0x54, 0x44, 0x48, 0x52, 0x67, 0x38, 0x77, 0x76, 0x78, 0x45, 0x70, 0x48, 0x6e, 0x5a, 0x43, 0x74, 0x4e, 0x56, 0x43, 0x41, 0x74, 0x45, 0x6e, 0x47, 0x4a, 0x46, 0x6d, 0x32, 0x30, 0x56, 0x45, 0x31, 0x30, 0x73, 0x6b, 0x6b, 0x43, 0x36, 0x46, 0x37, 0x70, 0x69, 0x46, 0x43, 0x6c, 0x53, 0x31, 0x55, 0x77, 0x36, 0x73, 0x4a, 0x50, 0x76, 0x6a, 0x52, 0x72, 0x78, 0x69, 0x63, 0x68, 0x56, 0x5a, 0x7a, 0x68, 0x33, 0x6b, 0x55, 0x53, 0x54, 0x4c, 0x45, 0x33, 0x44, 0x32, 0x33, 0x45, 0x71, 0x54 }; // static const size_t lzsa_test_07_plain_len = 560; static const uint8_t lzsa_test_07_lzsa1[] = { 0x7f, 0xf9, 0x30, 0x02, 0x31, 0x69, 0x6a, 0x5a, 0x55, 0x63, 0x36, 0x32, 0x69, 0x67, 0x64, 0x56, 0x6e, 0x67, 0x6f, 0x75, 0x64, 0x37, 0x64, 0x4b, 0x47, 0x76, 0x39, 0x36, 0x6e, 0x55, 0x37, 0x34, 0x35, 0x37, 0x62, 0x4e, 0x4f, 0x56, 0x74, 0x42, 0x67, 0x7a, 0x4a, 0x62, 0x70, 0x65, 0x6c, 0x4e, 0x43, 0x6b, 0x78, 0x72, 0x55, 0x75, 0x36, 0x6f, 0x58, 0x61, 0x42, 0x74, 0x43, 0x4d, 0x42, 0x39, 0x74, 0x43, 0x43, 0x67, 0x36, 0x4e, 0x78, 0x4c, 0x71, 0x53, 0x41, 0x68, 0x49, 0x76, 0x78, 0x69, 0x58, 0x68, 0x45, 0x53, 0x73, 0x7a, 0x34, 0x62, 0x57, 0x36, 0x6e, 0x79, 0x4a, 0x53, 0x43, 0x6c, 0x75, 0x53, 0x32, 0x6e, 0x56, 0x4c, 0x72, 0x31, 0x34, 0x6b, 0x4c, 0x4e, 0x54, 0x7a, 0x58, 0x32, 0x5a, 0x59, 0x69, 0x6c, 0x59, 0x46, 0x61, 0x4a, 0x61, 0x55, 0x4d, 0x75, 0x50, 0x4c, 0x45, 0x78, 0x77, 0x43, 0x6d, 0x39, 0x75, 0x66, 0x56, 0x71, 0x74, 0x43, 0x67, 0x51, 0x46, 0x55, 0x37, 0x49, 0x38, 0x65, 0x69, 0x69, 0x6b, 0x65, 0x34, 0x52, 0x38, 0x46, 0x57, 0x4a, 0x4f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x75, 0x33, 0x59, 0x54, 0x6f, 0x33, 0x67, 0x65, 0x42, 0x4a, 0x78, 0x4e, 0x32, 0x47, 0x47, 0x5a, 0x6b, 0x65, 0x4b, 0x79, 0x65, 0x52, 0x34, 0x78, 0x6a, 0x68, 0x72, 0x77, 0x36, 0x69, 0x36, 0x66, 0x6e, 0x6a, 0x68, 0x4e, 0x34, 0x76, 0x64, 0x45, 0x69, 0x6d, 0x45, 0x4b, 0x76, 0x36, 0x51, 0x54, 0x78, 0x79, 0x4f, 0x36, 0x6f, 0x75, 0x68, 0x49, 0x41, 0x6f, 0x39, 0x7a, 0x41, 0x31, 0x7a, 0x70, 0x49, 0x43, 0x57, 0x62, 0x78, 0x56, 0x6b, 0x52, 0x4d, 0x58, 0x35, 0x50, 0x32, 0x4e, 0x32, 0x4f, 0x36, 0x77, 0x56, 0x73, 0x39, 0x6f, 0x71, 0x47, 0x4d, 0x38, 0x6c, 0x52, 0x41, 0x6e, 0x4e, 0x4d, 0x54, 0x51, 0x63, 0x62, 0x53, 0x36, 0x34, 0x34, 0x54, 0x76, 0x49, 0x41, 0x30, 0x42, 0x57, 0x45, 0x31, 0x64, 0x33, 0x52, 0x59, 0x58, 0x4f, 0x50, 0x67, 0x6c, 0x52, 0x66, 0x4d, 0x47, 0x70, 0x34, 0x4d, 0x72, 0x6f, 0x4d, 0x44, 0x65, 0x33, 0x37, 0x6e, 0x5a, 0x51, 0x57, 0x54, 0x31, 0x4f, 0x43, 0x61, 0x65, 0x4a, 0x43, 0x69, 0x65, 0x45, 0x6a, 0x53, 0x78, 0x49, 0x6f, 0x4e, 0x4d, 0x6c, 0x70, 0x51, 0x72, 0x54, 0x4e, 0x6d, 0x48, 0x7a, 0x49, 0x44, 0x70, 0x6a, 0x45, 0x73, 0x49, 0x73, 0x48, 0x6b, 0x66, 0x36, 0x65, 0x6e, 0x35, 0x4d, 0x48, 0x6d, 0x65, 0x72, 0x59, 0x79, 0x6c, 0x42, 0x52, 0x41, 0x76, 0x71, 0x45, 0x48, 0x52, 0x71, 0x4c, 0x66, 0x41, 0x46, 0x56, 0x67, 0x6c, 0x41, 0x6e, 0x33, 0x4e, 0x47, 0x6f, 0x68, 0x35, 0x38, 0x68, 0x31, 0x61, 0x30, 0x5a, 0x64, 0x73, 0x4d, 0x6d, 0x65, 0x58, 0x64, 0x68, 0x6c, 0x6d, 0x74, 0x46, 0x32, 0x4d, 0x44, 0x47, 0x45, 0x41, 0x45, 0x70, 0x74, 0x56, 0x42, 0x67, 0x6d, 0x6b, 0x75, 0x6e, 0x62, 0x61, 0x36, 0x36, 0x5a, 0x32, 0x39, 0x49, 0x55, 0x55, 0x50, 0x69, 0x62, 0x72, 0x33, 0x36, 0x51, 0x30, 0x49, 0x61, 0x36, 0x39, 0x37, 0x5a, 0x69, 0x44, 0x37, 0x63, 0x7a, 0x47, 0x61, 0x37, 0x41, 0x73, 0x77, 0x55, 0x42, 0x42, 0x64, 0x50, 0x76, 0x44, 0x39, 0x31, 0x78, 0x47, 0x32, 0x6b, 0x56, 0x75, 0x57, 0x58, 0x75, 0x31, 0x59, 0x6d, 0x67, 0x61, 0x46, 0x78, 0x4d, 0x42, 0x35, 0x6a, 0x37, 0x78, 0x4c, 0x39, 0x51, 0x5a, 0x4d, 0x73, 0x59, 0x4c, 0x42, 0x54, 0x44, 0x48, 0x52, 0x67, 0x38, 0x77, 0x76, 0x78, 0x45, 0x70, 0x48, 0x6e, 0x5a, 0x43, 0x74, 0x4e, 0x56, 0x43, 0x41, 0x74, 0x45, 0x6e, 0x47, 0x4a, 0x46, 0x6d, 0x32, 0x30, 0x56, 0x45, 0x31, 0x30, 0x73, 0x6b, 0x6b, 0x43, 0x36, 0x46, 0x37, 0x70, 0x69, 0x46, 0x43, 0x6c, 0x53, 0x31, 0x55, 0x77, 0x36, 0x73, 0x4a, 0x50, 0x76, 0x6a, 0x52, 0x72, 0x78, 0x69, 0x63, 0x68, 0x56, 0x5a, 0x7a, 0x68, 0x33, 0x6b, 0x55, 0x53, 0x54, 0x4c, 0x45, 0x33, 0x44, 0x32, 0x33, 0x45, 0x71, 0x54, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_07_lzsa1_len = 568; static const uint8_t lzsa_test_07_lzsa2[] = { 0xff, 0xff, 0xef, 0x30, 0x02, 0x31, 0x69, 0x6a, 0x5a, 0x55, 0x63, 0x36, 0x32, 0x69, 0x67, 0x64, 0x56, 0x6e, 0x67, 0x6f, 0x75, 0x64, 0x37, 0x64, 0x4b, 0x47, 0x76, 0x39, 0x36, 0x6e, 0x55, 0x37, 0x34, 0x35, 0x37, 0x62, 0x4e, 0x4f, 0x56, 0x74, 0x42, 0x67, 0x7a, 0x4a, 0x62, 0x70, 0x65, 0x6c, 0x4e, 0x43, 0x6b, 0x78, 0x72, 0x55, 0x75, 0x36, 0x6f, 0x58, 0x61, 0x42, 0x74, 0x43, 0x4d, 0x42, 0x39, 0x74, 0x43, 0x43, 0x67, 0x36, 0x4e, 0x78, 0x4c, 0x71, 0x53, 0x41, 0x68, 0x49, 0x76, 0x78, 0x69, 0x58, 0x68, 0x45, 0x53, 0x73, 0x7a, 0x34, 0x62, 0x57, 0x36, 0x6e, 0x79, 0x4a, 0x53, 0x43, 0x6c, 0x75, 0x53, 0x32, 0x6e, 0x56, 0x4c, 0x72, 0x31, 0x34, 0x6b, 0x4c, 0x4e, 0x54, 0x7a, 0x58, 0x32, 0x5a, 0x59, 0x69, 0x6c, 0x59, 0x46, 0x61, 0x4a, 0x61, 0x55, 0x4d, 0x75, 0x50, 0x4c, 0x45, 0x78, 0x77, 0x43, 0x6d, 0x39, 0x75, 0x66, 0x56, 0x71, 0x74, 0x43, 0x67, 0x51, 0x46, 0x55, 0x37, 0x49, 0x38, 0x65, 0x69, 0x69, 0x6b, 0x65, 0x34, 0x52, 0x38, 0x46, 0x57, 0x4a, 0x4f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x75, 0x33, 0x59, 0x54, 0x6f, 0x33, 0x67, 0x65, 0x42, 0x4a, 0x78, 0x4e, 0x32, 0x47, 0x47, 0x5a, 0x6b, 0x65, 0x4b, 0x79, 0x65, 0x52, 0x34, 0x78, 0x6a, 0x68, 0x72, 0x77, 0x36, 0x69, 0x36, 0x66, 0x6e, 0x6a, 0x68, 0x4e, 0x34, 0x76, 0x64, 0x45, 0x69, 0x6d, 0x45, 0x4b, 0x76, 0x36, 0x51, 0x54, 0x78, 0x79, 0x4f, 0x36, 0x6f, 0x75, 0x68, 0x49, 0x41, 0x6f, 0x39, 0x7a, 0x41, 0x31, 0x7a, 0x70, 0x49, 0x43, 0x57, 0x62, 0x78, 0x56, 0x6b, 0x52, 0x4d, 0x58, 0x35, 0x50, 0x32, 0x4e, 0x32, 0x4f, 0x36, 0x77, 0x56, 0x73, 0x39, 0x6f, 0x71, 0x47, 0x4d, 0x38, 0x6c, 0x52, 0x41, 0x6e, 0x4e, 0x4d, 0x54, 0x51, 0x63, 0x62, 0x53, 0x36, 0x34, 0x34, 0x54, 0x76, 0x49, 0x41, 0x30, 0x42, 0x57, 0x45, 0x31, 0x64, 0x33, 0x52, 0x59, 0x58, 0x4f, 0x50, 0x67, 0x6c, 0x52, 0x66, 0x4d, 0x47, 0x70, 0x34, 0x4d, 0x72, 0x6f, 0x4d, 0x44, 0x65, 0x33, 0x37, 0x6e, 0x5a, 0x51, 0x57, 0x54, 0x31, 0x4f, 0x43, 0x61, 0x65, 0x4a, 0x43, 0x69, 0x65, 0x45, 0x6a, 0x53, 0x78, 0x49, 0x6f, 0x4e, 0x4d, 0x6c, 0x70, 0x51, 0x72, 0x54, 0x4e, 0x6d, 0x48, 0x7a, 0x49, 0x44, 0x70, 0x6a, 0x45, 0x73, 0x49, 0x73, 0x48, 0x6b, 0x66, 0x36, 0x65, 0x6e, 0x35, 0x4d, 0x48, 0x6d, 0x65, 0x72, 0x59, 0x79, 0x6c, 0x42, 0x52, 0x41, 0x76, 0x71, 0x45, 0x48, 0x52, 0x71, 0x4c, 0x66, 0x41, 0x46, 0x56, 0x67, 0x6c, 0x41, 0x6e, 0x33, 0x4e, 0x47, 0x6f, 0x68, 0x35, 0x38, 0x68, 0x31, 0x61, 0x30, 0x5a, 0x64, 0x73, 0x4d, 0x6d, 0x65, 0x58, 0x64, 0x68, 0x6c, 0x6d, 0x74, 0x46, 0x32, 0x4d, 0x44, 0x47, 0x45, 0x41, 0x45, 0x70, 0x74, 0x56, 0x42, 0x67, 0x6d, 0x6b, 0x75, 0x6e, 0x62, 0x61, 0x36, 0x36, 0x5a, 0x32, 0x39, 0x49, 0x55, 0x55, 0x50, 0x69, 0x62, 0x72, 0x33, 0x36, 0x51, 0x30, 0x49, 0x61, 0x36, 0x39, 0x37, 0x5a, 0x69, 0x44, 0x37, 0x63, 0x7a, 0x47, 0x61, 0x37, 0x41, 0x73, 0x77, 0x55, 0x42, 0x42, 0x64, 0x50, 0x76, 0x44, 0x39, 0x31, 0x78, 0x47, 0x32, 0x6b, 0x56, 0x75, 0x57, 0x58, 0x75, 0x31, 0x59, 0x6d, 0x67, 0x61, 0x46, 0x78, 0x4d, 0x42, 0x35, 0x6a, 0x37, 0x78, 0x4c, 0x39, 0x51, 0x5a, 0x4d, 0x73, 0x59, 0x4c, 0x42, 0x54, 0x44, 0x48, 0x52, 0x67, 0x38, 0x77, 0x76, 0x78, 0x45, 0x70, 0x48, 0x6e, 0x5a, 0x43, 0x74, 0x4e, 0x56, 0x43, 0x41, 0x74, 0x45, 0x6e, 0x47, 0x4a, 0x46, 0x6d, 0x32, 0x30, 0x56, 0x45, 0x31, 0x30, 0x73, 0x6b, 0x6b, 0x43, 0x36, 0x46, 0x37, 0x70, 0x69, 0x46, 0x43, 0x6c, 0x53, 0x31, 0x55, 0x77, 0x36, 0x73, 0x4a, 0x50, 0x76, 0x6a, 0x52, 0x72, 0x78, 0x69, 0x63, 0x68, 0x56, 0x5a, 0x7a, 0x68, 0x33, 0x6b, 0x55, 0x53, 0x54, 0x4c, 0x45, 0x33, 0x44, 0x32, 0x33, 0x45, 0x71, 0x54, 0xe8 }; // static const size_t lzsa_test_07_lzsa2_len = 566; /******************************************************************************/ static const uint8_t lzsa_test_08_plain[] = { 0x04, 0x97, 0x89, 0x8d, 0x00, 0xa6, 0xc9, 0x5b, 0x02, 0x87, 0x1e, 0x06, 0x89, 0x1e, 0x06, 0x89, 0x5f, 0x89, 0x4b, 0x1e, 0x4b, 0xa9, 0x4b, 0x00, 0x8d, 0x00, 0xaa, 0x04, 0x5b, 0x09, 0x87, 0x96, 0x1c, 0x00, 0x06, 0x89, 0x1e, 0x06, 0x89, 0x5f, 0x89, 0x4b, 0x1e, 0x4b, 0xa9, 0x4b, 0x00, 0x8d, 0x00, 0xaa, 0x04, 0x5b, 0x09, 0x87, 0x7b, 0x04, 0xab, 0x30, 0xa1, 0x39, 0x23, 0x08, 0xab, 0x07, 0x0d, 0x05, 0x27, 0x02, 0xab, 0x20, 0x1e, 0x09, 0x89, 0x88, 0x4b, 0x77, 0x4b, 0xa9, 0x4b, 0x00, 0x1e, 0x0d, 0x89, 0x7b, 0x0e, 0x88, 0x87, 0x5b, 0x03, 0x87, 0x88, 0x7b, 0x05, 0x4e, 0xa4, 0x0f, 0x6b, 0x01, 0x1e, 0x0a, 0x89, 0x1e, 0x0a, 0x89, 0x7b, 0x0b, 0x88, 0x7b, 0x0b, 0x88, 0x7b, 0x07, 0x88, 0x8d, 0x00, 0xa9, 0x56, 0x5b, 0x07, 0x7b, 0x05, 0xa4, 0x0f, 0x6b, 0x01, 0x1e, 0x0a, 0x89, 0x1e, 0x0a, 0x89, 0x7b, 0x0b, 0x88, 0x7b, 0x0b, 0x88, 0x7b, 0x07, 0x88, 0x8d, 0x00, 0xa9, 0x56, 0x5b, 0x08, 0x87, 0x52, 0x0b, 0x16, 0x0f, 0x17, 0x01, 0x93, 0x90, 0xee, 0x02, 0xfe, 0x1f, 0x07, 0x1e, 0x01, 0x1c, 0x00, 0x04, 0xa6, 0x20, 0x6b, 0x0b, 0xf6, 0x48, 0x6b, 0x06, 0x7b, 0x07, 0x48, 0x4f, 0x49, 0x1a, 0x06, 0xf7, 0x90, 0x58, 0x09, 0x08, 0x09, 0x07, 0x11, 0x11, 0x25, 0x15, 0xf6, 0x10, 0x11, 0xf7, 0x90, 0x54, 0x99, 0x90, 0x59, 0x7b, 0x07, 0x6b, 0x03, 0x7b, 0x08, 0x6b, 0x08, 0x7b, 0x03, 0x6b, 0x07, 0x0a, 0x0b, 0x0d, 0x0b, 0x26, 0xcf, 0x1e, 0x01, 0xef, 0x02, 0x16, 0x07, 0xff, 0x5b, 0x0b, 0x87, 0x52, 0x29, 0x5f, 0x1f, 0x10, 0x96, 0x1c, 0x00, 0x09, 0x1f, 0x12, 0x1f, 0x14, 0x16, 0x12, 0x17, 0x16, 0x1e, 0x32, 0xf6, 0x5c, 0x1f, 0x32, 0x97, 0x4d, 0x26, 0x04, 0xac, 0x00, 0xb0, 0xb4, 0x9f, 0xa1, 0x25, 0x27, 0x04, 0xac, 0x00, 0xb0, 0x96, 0x0f, 0x18, 0x0f, 0x19, 0x0f, 0x1a, 0x0f, 0x1b, 0x0f, 0x1c, 0x0f, 0x1d, 0x0f, 0x1e, 0x0f, 0x1f, 0x0f, 0x20, 0x5f, 0x1f }; // static const size_t lzsa_test_08_plain_len = 288; static const uint8_t lzsa_test_08_lzsa1[] = { 0x7f, 0x1b, 0x04, 0x97, 0x89, 0x8d, 0x00, 0xa6, 0xc9, 0x5b, 0x02, 0x87, 0x1e, 0x06, 0x89, 0x1e, 0x06, 0x89, 0x5f, 0x89, 0x4b, 0x1e, 0x4b, 0xa9, 0x4b, 0x00, 0x8d, 0x00, 0xaa, 0x04, 0x5b, 0x09, 0x87, 0x96, 0x1c, 0x00, 0xe9, 0x02, 0x71, 0x0f, 0x7b, 0x04, 0xab, 0x30, 0xa1, 0x39, 0x23, 0x08, 0xab, 0x07, 0x0d, 0x05, 0x27, 0x02, 0xab, 0x20, 0x1e, 0x09, 0x89, 0x88, 0x4b, 0x77, 0xdf, 0x70, 0x0e, 0x1e, 0x0d, 0x89, 0x7b, 0x0e, 0x88, 0x87, 0x5b, 0x03, 0x87, 0x88, 0x7b, 0x05, 0x4e, 0xa4, 0x0f, 0x6b, 0x01, 0x1e, 0x0a, 0x89, 0xfd, 0x31, 0x7b, 0x0b, 0x88, 0xfd, 0x7f, 0x03, 0x07, 0x88, 0x8d, 0x00, 0xa9, 0x56, 0x5b, 0x07, 0x7b, 0x05, 0xe5, 0x06, 0x71, 0x6f, 0x08, 0x87, 0x52, 0x0b, 0x16, 0x0f, 0x17, 0x01, 0x93, 0x90, 0xee, 0x02, 0xfe, 0x1f, 0x07, 0x1e, 0x01, 0x1c, 0x00, 0x04, 0xa6, 0x20, 0x6b, 0x0b, 0xf6, 0x48, 0x6b, 0x06, 0x7b, 0x07, 0x48, 0x4f, 0x49, 0x1a, 0x06, 0xf7, 0x90, 0x58, 0x09, 0x08, 0x09, 0x07, 0x11, 0x11, 0x25, 0x15, 0xf6, 0x10, 0x11, 0xf7, 0x90, 0x54, 0x99, 0x90, 0x59, 0x7b, 0x07, 0x6b, 0x03, 0x7b, 0x08, 0x6b, 0x08, 0x7b, 0x03, 0x6b, 0x07, 0x0a, 0x0b, 0x0d, 0x0b, 0x26, 0xcf, 0x1e, 0x01, 0xef, 0x02, 0x16, 0x07, 0xff, 0x5b, 0x0b, 0x87, 0x52, 0x29, 0x5f, 0x1f, 0x10, 0x96, 0x1c, 0x00, 0x09, 0x1f, 0x12, 0x1f, 0x14, 0x16, 0x12, 0x17, 0x16, 0x1e, 0x32, 0xf6, 0x5c, 0x1f, 0x32, 0x97, 0x4d, 0x26, 0x04, 0xac, 0x00, 0xb0, 0xb4, 0x9f, 0xa1, 0x25, 0x27, 0xf7, 0x7f, 0x0e, 0x96, 0x0f, 0x18, 0x0f, 0x19, 0x0f, 0x1a, 0x0f, 0x1b, 0x0f, 0x1c, 0x0f, 0x1d, 0x0f, 0x1e, 0x0f, 0x1f, 0x0f, 0x20, 0x5f, 0x1f, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_08_lzsa1_len = 254; static const uint8_t lzsa_test_08_lzsa2[] = { 0x19, 0xae, 0x04, 0x97, 0x89, 0x8d, 0x00, 0xa6, 0xc9, 0x5b, 0x02, 0x87, 0x1e, 0x06, 0x89, 0x18, 0x55, 0x5f, 0x89, 0x4b, 0x1e, 0x4b, 0xa9, 0x4b, 0x00, 0x1f, 0x54, 0xaa, 0x04, 0x5b, 0x09, 0x87, 0x96, 0x1c, 0x00, 0xbf, 0x5a, 0x04, 0x7b, 0x04, 0xab, 0x30, 0xa1, 0x39, 0x23, 0x08, 0xab, 0x07, 0x0d, 0x05, 0x27, 0x02, 0xab, 0x20, 0x1e, 0x09, 0x89, 0x88, 0x4b, 0x77, 0xc8, 0x19, 0xfe, 0x03, 0x1e, 0x0d, 0x89, 0x7b, 0x0e, 0x88, 0x87, 0x5b, 0x03, 0x87, 0x88, 0x7b, 0x05, 0x4e, 0xa4, 0x0f, 0x6b, 0x01, 0x1e, 0x0a, 0x89, 0xfa, 0x05, 0x7b, 0x0b, 0x88, 0x38, 0x07, 0x88, 0x8d, 0x00, 0xa9, 0x56, 0x5b, 0x07, 0x22, 0x07, 0xff, 0x00, 0x1a, 0x64, 0x08, 0x87, 0x52, 0x0b, 0x16, 0x0f, 0x17, 0x01, 0x93, 0x90, 0xee, 0x02, 0xfe, 0x1f, 0x07, 0x1e, 0x01, 0x1c, 0x00, 0x04, 0xa6, 0x20, 0x6b, 0x0b, 0xf6, 0x48, 0x6b, 0x06, 0x7b, 0x07, 0x48, 0x4f, 0x49, 0x1a, 0x06, 0xf7, 0x90, 0x58, 0x09, 0x08, 0x09, 0x07, 0x11, 0x11, 0x25, 0x15, 0xf6, 0x10, 0x11, 0xf7, 0x90, 0x54, 0x99, 0x90, 0x59, 0x7b, 0x07, 0x6b, 0x03, 0x7b, 0x08, 0x6b, 0x08, 0x7b, 0x03, 0x6b, 0x07, 0x0a, 0x0b, 0x0d, 0x0b, 0x26, 0xcf, 0x1e, 0x01, 0xef, 0x02, 0x16, 0x07, 0xff, 0x5b, 0x0b, 0x87, 0x52, 0x29, 0x5f, 0x1f, 0x10, 0x96, 0x1c, 0x00, 0x09, 0x1f, 0x12, 0x1f, 0x14, 0x16, 0x12, 0x17, 0x16, 0x1e, 0x32, 0xf6, 0x5c, 0x1f, 0x32, 0x97, 0x4d, 0x26, 0x04, 0xac, 0x00, 0xb0, 0xb4, 0x9f, 0xa1, 0x25, 0x27, 0xbf, 0xff, 0x03, 0x96, 0x0f, 0x18, 0x0f, 0x19, 0x0f, 0x1a, 0x0f, 0x1b, 0x0f, 0x1c, 0x0f, 0x1d, 0x0f, 0x1e, 0x0f, 0x1f, 0x0f, 0x20, 0x5f, 0x1f, 0xf0, 0xe8 }; // static const size_t lzsa_test_08_lzsa2_len = 249; /******************************************************************************/ static const uint8_t lzsa_test_09_plain[] = { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 }; // static const size_t lzsa_test_09_plain_len = 288; static const uint8_t lzsa_test_09_lzsa1[] = { 0x1f, 0x41, 0xff, 0xef, 0x1f, 0x0f, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_09_lzsa1_len = 10; static const uint8_t lzsa_test_09_lzsa2[] = { 0x0f, 0x41, 0xff, 0xe9, 0x1f, 0x01, 0xe7, 0xf0, 0xe8 }; // static const size_t lzsa_test_09_lzsa2_len = 9; /******************************************************************************/ static const uint8_t lzsa_test_10_plain[] = { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 }; // static const size_t lzsa_test_10_plain_len = 560; static const uint8_t lzsa_test_10_lzsa1[] = { 0x1f, 0x41, 0xff, 0xee, 0x2f, 0x02, 0x0f, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_10_lzsa1_len = 11; static const uint8_t lzsa_test_10_lzsa2[] = { 0x0f, 0x41, 0xff, 0xe9, 0x2f, 0x02, 0xe7, 0xf0, 0xe8 }; // static const size_t lzsa_test_10_lzsa2_len = 9; /******************************************************************************/ static const uint8_t lzsa_test_11_plain[] = { 0x41, 0x6c, 0x69, 0x63, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x67, 0x65, 0x74, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x74, 0x69, 0x72, 0x65, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x69, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x62, 0x79, 0x20, 0x68, 0x65, 0x72, 0x20, 0x73, 0x69, 0x73, 0x74, 0x65, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0d, 0x0a, 0x62, 0x61, 0x6e, 0x6b, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x68, 0x61, 0x76, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x64, 0x6f, 0x3a, 0x20, 0x6f, 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x77, 0x69, 0x63, 0x65, 0x20, 0x73, 0x68, 0x65, 0x20, 0x68, 0x61, 0x64, 0x20, 0x70, 0x65, 0x65, 0x70, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0d, 0x0a, 0x74, 0x68, 0x65, 0x20, 0x62, 0x6f, 0x6f, 0x6b, 0x20, 0x68, 0x65, 0x72, 0x20, 0x73, 0x69, 0x73, 0x74, 0x65, 0x72, 0x20, 0x77, 0x61, 0x73, 0x20, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x69, 0x74, 0x20, 0x68, 0x61, 0x64, 0x20, 0x6e, 0x6f, 0x20, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x72, 0x0d, 0x0a, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x69, 0x74, 0x2c, 0x20, 0x93, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x68, 0x61, 0x74, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x62, 0x6f, 0x6f, 0x6b, 0x2c, 0x94, 0x20, 0x74, 0x68, 0x6f, 0x75, 0x67, 0x68, 0x74, 0x20, 0x41, 0x6c, 0x69, 0x63, 0x65, 0x0d, 0x0a, 0x93, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x73, 0x20, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3f, 0x94, 0x0d, 0x0a, 0x0d, 0x0a, 0x53, 0x6f, 0x20, 0x73, 0x68, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x20, 0x68, 0x65, 0x72, 0x20, 0x6f, 0x77, 0x6e, 0x20, 0x6d, 0x69, 0x6e, 0x64, 0x20, 0x28, 0x61, 0x73, 0x20, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x61, 0x73, 0x20, 0x73, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x75, 0x6c, 0x64, 0x2c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x0d, 0x0a, 0x68, 0x6f, 0x74, 0x20, 0x64, 0x61, 0x79, 0x20, 0x6d, 0x61, 0x64, 0x65, 0x20, 0x68, 0x65, 0x72, 0x20, 0x66, 0x65, 0x65, 0x6c, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x73, 0x6c, 0x65, 0x65, 0x70, 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74, 0x75, 0x70, 0x69, 0x64, 0x29, 0x2c, 0x20, 0x77, 0x68, 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x6c, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x20, 0x6f, 0x66, 0x0d, 0x0a, 0x6d, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x64, 0x61, 0x69, 0x73, 0x79, 0x2d, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x77, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x67, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x75, 0x70, 0x20, 0x61, 0x6e, 0x64, 0x0d, 0x0a, 0x70, 0x69, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x61, 0x69, 0x73, 0x69, 0x65, 0x73, 0x2c, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x73, 0x75, 0x64, 0x64, 0x65, 0x6e, 0x6c, 0x79, 0x20, 0x61, 0x20, 0x57, 0x68, 0x69, 0x74, 0x65, 0x20, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x70, 0x69, 0x6e, 0x6b, 0x20, 0x65, 0x79, 0x65, 0x73, 0x20, 0x72, 0x61, 0x6e, 0x0d, 0x0a, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x20, 0x62, 0x79, 0x20, 0x68, 0x65, 0x72, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x54, 0x68, 0x65, 0x72, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x6f, 0x20, 0x5f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x20, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x61, 0x74, 0x3b, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x64, 0x69, 0x64, 0x20, 0x41, 0x6c, 0x69, 0x63, 0x65, 0x20, 0x74, 0x68, 0x69, 0x6e, 0x6b, 0x20, 0x69, 0x74, 0x0d, 0x0a, 0x73, 0x6f, 0x20, 0x5f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x20, 0x6d, 0x75, 0x63, 0x68, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x61, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x68, 0x65, 0x61, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x20, 0x73, 0x61, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x69, 0x74, 0x73, 0x65, 0x6c, 0x66, 0x2c, 0x20, 0x93, 0x4f, 0x68, 0x0d, 0x0a, 0x64, 0x65, 0x61, 0x72, 0x21, 0x20, 0x4f, 0x68, 0x20, 0x64, 0x65, 0x61, 0x72, 0x21, 0x20, 0x49, 0x20, 0x73, 0x68, 0x61, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x21, 0x94, 0x20, 0x28, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x73, 0x68, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x75, 0x67, 0x68, 0x74, 0x20, 0x69, 0x74, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x77, 0x61, 0x72, 0x64, 0x73, 0x2c, 0x0d, 0x0a, 0x69, 0x74, 0x20, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x73, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x67, 0x68, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x77, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x65, 0x64, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x0d, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x69, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x73, 0x65, 0x65, 0x6d, 0x65, 0x64, 0x20, 0x71, 0x75, 0x69, 0x74, 0x65, 0x20, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x29, 0x3b, 0x20, 0x62, 0x75, 0x74, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x20, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x5f, 0x74, 0x6f, 0x6f, 0x6b, 0x20, 0x61, 0x0d, 0x0a, 0x77, 0x61, 0x74, 0x63, 0x68, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x20, 0x77, 0x61, 0x69, 0x73, 0x74, 0x63, 0x6f, 0x61, 0x74, 0x2d, 0x70, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x65, 0x64, 0x20, 0x61, 0x74, 0x20, 0x69, 0x74, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x68, 0x75, 0x72, 0x72, 0x69, 0x65, 0x64, 0x0d, 0x0a, 0x6f, 0x6e, 0x2c, 0x20, 0x41, 0x6c, 0x69, 0x63, 0x65, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x68, 0x65, 0x72, 0x20, 0x66, 0x65, 0x65, 0x74, 0x2c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x66, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x64, 0x20, 0x61, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x20, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x69, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x73, 0x68, 0x65, 0x0d, 0x0a, 0x68, 0x61, 0x64, 0x20, 0x6e, 0x65, 0x76, 0x65, 0x72, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x65, 0x65, 0x6e, 0x20, 0x61, 0x20, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x61, 0x20, 0x77, 0x61, 0x69, 0x73, 0x74, 0x63, 0x6f, 0x61, 0x74, 0x2d, 0x70, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x61, 0x0d, 0x0a, 0x77, 0x61, 0x74, 0x63, 0x68, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x61, 0x6b, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x75, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x63, 0x75, 0x72, 0x69, 0x6f, 0x73, 0x69, 0x74, 0x79, 0x2c, 0x20, 0x73, 0x68, 0x65, 0x20, 0x72, 0x61, 0x6e, 0x20, 0x61, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x20, 0x74, 0x68, 0x65, 0x0d, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x69, 0x74, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x74, 0x75, 0x6e, 0x61, 0x74, 0x65, 0x6c, 0x79, 0x20, 0x77, 0x61, 0x73, 0x20, 0x6a, 0x75, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x65, 0x65, 0x20, 0x69, 0x74, 0x20, 0x70, 0x6f, 0x70, 0x20, 0x64, 0x6f, 0x77, 0x6e, 0x20, 0x61, 0x0d, 0x0a, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x20, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x2d, 0x68, 0x6f, 0x6c, 0x65, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x68, 0x65, 0x64, 0x67, 0x65, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x49, 0x6e, 0x20, 0x61, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x6f, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x64, 0x6f, 0x77, 0x6e, 0x20, 0x77, 0x65, 0x6e, 0x74, 0x20, 0x41, 0x6c, 0x69, 0x63, 0x65, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x20, 0x69, 0x74, 0x2c, 0x20, 0x6e, 0x65, 0x76, 0x65, 0x72, 0x20, 0x6f, 0x6e, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x6f, 0x77, 0x0d, 0x0a, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x20, 0x73, 0x68, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x67, 0x65, 0x74, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x67, 0x61, 0x69, 0x6e, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x54, 0x68, 0x65, 0x20, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x2d, 0x68, 0x6f, 0x6c, 0x65, 0x20, 0x77, 0x65, 0x6e, 0x74, 0x20, 0x73, 0x74, 0x72, 0x61, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6f, 0x6e, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x61, 0x20, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x77, 0x61, 0x79, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0d, 0x0a, 0x64, 0x69, 0x70, 0x70, 0x65, 0x64, 0x20, 0x73, 0x75, 0x64, 0x64, 0x65, 0x6e, 0x6c, 0x79, 0x20, 0x64, 0x6f, 0x77, 0x6e, 0x2c, 0x20, 0x73, 0x6f, 0x20, 0x73, 0x75, 0x64, 0x64, 0x65, 0x6e, 0x6c, 0x79, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x41, 0x6c, 0x69, 0x63, 0x65, 0x20, 0x68, 0x61, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x20, 0x6d, 0x6f, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x69, 0x6e, 0x6b, 0x0d, 0x0a, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x74, 0x6f, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x65, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x68, 0x65, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x20, 0x66, 0x61, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x6f, 0x77, 0x6e, 0x20, 0x61, 0x20, 0x76, 0x65, 0x72, 0x79, 0x0d, 0x0a, 0x64, 0x65, 0x65, 0x70, 0x20, 0x77, 0x65, 0x6c, 0x6c, 0x2e }; // static const size_t lzsa_test_11_plain_len = 1696; static const uint8_t lzsa_test_11_lzsa1[] = { 0x71, 0x26, 0x41, 0x6c, 0x69, 0x63, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x67, 0x65, 0x74, 0x20, 0x76, 0x65, 0x72, 0x79, 0x20, 0x74, 0x69, 0x72, 0x65, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x69, 0x74, 0x74, 0xe3, 0x60, 0x62, 0x79, 0x20, 0x68, 0x65, 0x72, 0xf1, 0x20, 0x73, 0x74, 0xf9, 0x72, 0x09, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x0d, 0x0a, 0x62, 0x61, 0x6e, 0x6b, 0x2c, 0x20, 0x61, 0x6e, 0xd5, 0x31, 0x68, 0x61, 0x76, 0xd6, 0x44, 0x6e, 0x6f, 0x74, 0x68, 0xb1, 0x30, 0x64, 0x6f, 0x3a, 0xd5, 0x00, 0x97, 0x51, 0x6f, 0x72, 0x20, 0x74, 0x77, 0x8e, 0x30, 0x73, 0x68, 0x65, 0xd8, 0x60, 0x64, 0x20, 0x70, 0x65, 0x65, 0x70, 0x9f, 0x60, 0x69, 0x6e, 0x74, 0x6f, 0x0d, 0x0a, 0xb5, 0x58, 0x20, 0x62, 0x6f, 0x6f, 0x6b, 0x9e, 0x02, 0x65, 0x40, 0x72, 0x65, 0x61, 0x64, 0xb6, 0x72, 0x01, 0x2c, 0x20, 0x62, 0x75, 0x74, 0x20, 0x69, 0x74, 0xc7, 0x70, 0x04, 0x6e, 0x6f, 0x20, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x73, 0xaa, 0x50, 0x0d, 0x0a, 0x63, 0x6f, 0x6e, 0x4f, 0x70, 0x00, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xb0, 0x00, 0xd8, 0x31, 0x2c, 0x20, 0x93, 0x6e, 0x30, 0x77, 0x68, 0x61, 0xca, 0x21, 0x73, 0x20, 0xa2, 0x31, 0x75, 0x73, 0x65, 0x5e, 0x12, 0x61, 0x99, 0x20, 0x2c, 0x94, 0xec, 0xe2, 0x6f, 0x75, 0x67, 0x68, 0x74, 0x20, 0xf9, 0xfe, 0x51, 0x0d, 0x0a, 0x93, 0x77, 0x69, 0xee, 0x19, 0x74, 0xa5, 0x1a, 0x20, 0xa6, 0x71, 0x01, 0x3f, 0x94, 0x0d, 0x0a, 0x0d, 0x0a, 0x53, 0x6f, 0x3f, 0x02, 0x64, 0x10, 0x63, 0xeb, 0x41, 0x69, 0x64, 0x65, 0x72, 0x16, 0x22, 0x69, 0x6e, 0x46, 0x60, 0x6f, 0x77, 0x6e, 0x20, 0x6d, 0x69, 0x86, 0x10, 0x28, 0xe0, 0x50, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0xf8, 0x00, 0xd0, 0x00, 0xd4, 0x60, 0x75, 0x6c, 0x64, 0x2c, 0x20, 0x66, 0xab, 0x82, 0xca, 0xfe, 0x72, 0x05, 0x68, 0x6f, 0x74, 0x20, 0x64, 0x61, 0x79, 0x20, 0x6d, 0x61, 0x64, 0x65, 0xc6, 0xc3, 0x66, 0x65, 0x65, 0x6c, 0x88, 0xfe, 0xe2, 0x73, 0x6c, 0x65, 0x65, 0x70, 0x79, 0xae, 0xfe, 0x70, 0x01, 0x73, 0x74, 0x75, 0x70, 0x69, 0x64, 0x29, 0x2c, 0x37, 0x20, 0x65, 0x74, 0xda, 0x02, 0x37, 0x50, 0x70, 0x6c, 0x65, 0x61, 0x73, 0x5e, 0x00, 0x32, 0x51, 0x0d, 0x0a, 0x6d, 0x61, 0x6b, 0x81, 0x10, 0x61, 0xb3, 0x70, 0x00, 0x69, 0x73, 0x79, 0x2d, 0x63, 0x68, 0x61, 0x76, 0x11, 0x77, 0x93, 0x30, 0x20, 0x62, 0x65, 0xf7, 0x32, 0x72, 0x74, 0x68, 0xcb, 0xe2, 0x74, 0x72, 0x6f, 0x75, 0x62, 0x6c, 0xfe, 0xfe, 0xa3, 0x67, 0x65, 0x31, 0xfe, 0x21, 0x75, 0x70, 0x9c, 0x20, 0x0d, 0x0a, 0x0f, 0x01, 0xbc, 0x01, 0xd9, 0x02, 0xba, 0x32, 0x69, 0x65, 0x73, 0x8f, 0xf1, 0x13, 0x6e, 0x20, 0x73, 0x75, 0x64, 0x64, 0x65, 0x6e, 0x6c, 0x79, 0x20, 0x61, 0x20, 0x57, 0x68, 0x69, 0x74, 0x65, 0x20, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x20, 0xd5, 0xfe, 0x80, 0xd8, 0xfe, 0xe0, 0x6e, 0x6b, 0x20, 0x65, 0x79, 0x65, 0x5c, 0xfe, 0xa0, 0x61, 0x6e, 0x7b, 0xfe, 0xc4, 0x6c, 0x6f, 0x73, 0x65, 0xdd, 0xfd, 0x91, 0x2e, 0xd7, 0xfe, 0x10, 0x54, 0xf7, 0x82, 0xd8, 0xfe, 0x86, 0xf2, 0xfd, 0x41, 0x73, 0x6f, 0x20, 0x5f, 0x1e, 0x90, 0x5f, 0x2a, 0xfe, 0x51, 0x6d, 0x61, 0x72, 0x6b, 0x61, 0x6f, 0x91, 0x69, 0xb9, 0xfd, 0x30, 0x61, 0x74, 0x3b, 0xda, 0xd3, 0x72, 0x20, 0x64, 0x69, 0x64, 0x70, 0xfe, 0x00, 0xec, 0x01, 0xa1, 0x47, 0x69, 0x74, 0x0d, 0x0a, 0xca, 0xd1, 0x6d, 0x75, 0x63, 0x68, 0x20, 0x5d, 0xfe, 0x22, 0x6f, 0x66, 0x53, 0xb1, 0x77, 0x61, 0x79, 0x9e, 0xfd, 0xb1, 0x68, 0x65, 0x61, 0xe7, 0xfe, 0x06, 0x62, 0x13, 0x73, 0xe9, 0xe0, 0x69, 0x74, 0x73, 0x65, 0x6c, 0x66, 0xf7, 0xfd, 0x50, 0x4f, 0x68, 0x0d, 0x0a, 0x64, 0xdc, 0x53, 0x21, 0x20, 0x4f, 0x68, 0x20, 0xf7, 0x90, 0x49, 0x6c, 0xfe, 0xb1, 0x61, 0x6c, 0x6c, 0xdd, 0xfe, 0x73, 0x01, 0x6c, 0x61, 0x74, 0x65, 0x21, 0x94, 0x20, 0x28, 0x0f, 0xa6, 0x68, 0x65, 0xe8, 0xfd, 0x10, 0x69, 0x98, 0x00, 0x88, 0x71, 0x07, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72, 0x77, 0x61, 0x72, 0x64, 0x73, 0x2c, 0x0d, 0x0a, 0xeb, 0xc0, 0x63, 0x63, 0x75, 0x72, 0xe6, 0xfc, 0x03, 0x85, 0x12, 0x72, 0x42, 0x02, 0xc7, 0x02, 0xc9, 0x02, 0xea, 0xa1, 0x61, 0x76, 0x85, 0xfe, 0x31, 0x6e, 0x64, 0x65, 0xd9, 0x21, 0x61, 0x74, 0x33, 0x93, 0x73, 0x3e, 0xfd, 0xa3, 0x61, 0x74, 0x01, 0xfe, 0x41, 0x74, 0x69, 0x6d, 0x65, 0x9e, 0x01, 0x7b, 0x40, 0x73, 0x65, 0x65, 0x6d, 0xd8, 0xa1, 0x71, 0x75, 0x9e, 0xfe, 0xa0, 0x6e, 0x61, 0x83, 0xfd, 0x42, 0x61, 0x6c, 0x29, 0x3b, 0xd1, 0x01, 0x6b, 0x09, 0x25, 0x40, 0x61, 0x63, 0x74, 0x75, 0xcd, 0xc1, 0x79, 0x20, 0x5f, 0x74, 0xd4, 0xfc, 0xe6, 0x61, 0x0d, 0x0a, 0x77, 0x61, 0x74, 0xeb, 0xfe, 0x01, 0x0d, 0xf3, 0x0b, 0x20, 0x77, 0x61, 0x69, 0x73, 0x74, 0x63, 0x6f, 0x61, 0x74, 0x2d, 0x70, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x64, 0xfc, 0x10, 0x6c, 0xd0, 0x03, 0x73, 0x23, 0x69, 0x74, 0xee, 0x11, 0x74, 0xa4, 0x10, 0x68, 0x35, 0xa0, 0x69, 0x65, 0xfb, 0xfd, 0xb4, 0x6f, 0x6e, 0x2c, 0x86, 0xfe, 0x57, 0x73, 0x74, 0x61, 0x72, 0x74, 0x21, 0xc2, 0x66, 0x65, 0x65, 0x74, 0x48, 0xfd, 0x01, 0x51, 0x51, 0x66, 0x6c, 0x61, 0x73, 0x68, 0xb9, 0x51, 0x63, 0x72, 0x6f, 0x73, 0x73, 0xe0, 0x82, 0x12, 0xfd, 0x86, 0xfc, 0xfe, 0xa2, 0x0d, 0x0a, 0x60, 0xfc, 0x91, 0x65, 0xc8, 0xfe, 0x20, 0x62, 0x65, 0xcb, 0x11, 0x65, 0x22, 0xd8, 0x6e, 0x20, 0x61, 0x20, 0x72, 0xc6, 0xfd, 0xa2, 0x65, 0x69, 0x34, 0xfd, 0x1e, 0x61, 0x54, 0x46, 0x2c, 0x20, 0x6f, 0x72, 0x2b, 0x01, 0x7f, 0x44, 0x74, 0x61, 0x6b, 0x65, 0x23, 0x06, 0x48, 0xb1, 0x62, 0x75, 0x72, 0x55, 0xfb, 0x03, 0xb5, 0xd0, 0x63, 0x75, 0x72, 0x69, 0x6f, 0x60, 0xfb, 0x21, 0x79, 0x2c, 0x81, 0x81, 0x76, 0xfd, 0x04,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x70, 0x77, 0xfa, 0x86, 0x12, 0xfc, 0x02, 0x49, 0x10, 0x2c, 0xd6, 0x07, 0xee, 0x34, 0x74, 0x68, 0x61, 0x3c, 0x84, 0x7f, 0xfa, 0x00, 0x7a, 0x05, 0x1b, 0xa3, 0x74, 0x6f, 0x53, 0xfc, 0x61, 0x0d, 0x0a, 0x61, 0x62, 0x6f, 0x75, 0x80, 0x32, 0x6f, 0x70, 0x70, 0x33, 0xa1, 0x65, 0x72, 0x7e, 0xfc, 0x86, 0xf7, 0xfd, 0x20, 0x68, 0x65, 0x7e, 0x36, 0x75, 0x6e, 0x64, 0xe7, 0x40, 0x66, 0x61, 0x6c, 0x6c, 0xd7, 0x84, 0x99, 0xfe, 0x82, 0x03, 0xfb, 0x81, 0x56, 0xfc, 0xa2, 0x65, 0x70, 0xc6, 0xfa, 0x1f, 0x2e, 0x00, 0xee, 0x00, 0x00 }; // static const size_t lzsa_test_11_lzsa1_len = 1151; static const uint8_t lzsa_test_11_lzsa2[] = { 0x18, 0xde, 0x41, 0x6c, 0x69, 0x63, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x6e, 0x38, 0xaa, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x67, 0x65, 0x74, 0x20, 0x76, 0x65, 0x72, 0x79, 0x1a, 0x91, 0x69, 0x72, 0x65, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x69, 0x74, 0x74, 0x28, 0x62, 0x63, 0x08, 0x68, 0x01, 0x8c, 0x11, 0x73, 0x74, 0x50, 0x6f, 0x6e, 0xde, 0x00, 0x85, 0x18, 0x0d, 0x0a, 0x62, 0x61, 0x6e, 0x6b, 0x2c, 0x20, 0xd0, 0x43, 0xd5, 0x5a, 0x68, 0x61, 0x76, 0xb9, 0x10, 0x6e, 0x6f, 0x20, 0x45, 0xb1, 0x59, 0x64, 0x6f, 0x3a, 0xd5, 0x41, 0x97, 0x10, 0x6f, 0x72, 0x86, 0x4a, 0x77, 0x8e, 0x48, 0x73, 0xca, 0x41, 0xd8, 0xf8, 0x64, 0x20, 0x70, 0x65, 0x65, 0x70, 0x65, 0x64, 0x20, 0x50, 0x74, 0x6f, 0xba, 0x09, 0x74, 0x51, 0x5f, 0x62, 0x6f, 0x6f, 0x6b, 0x9e, 0x21, 0x43, 0x65, 0x50, 0x72, 0x65, 0xd6, 0x41, 0x67, 0x08, 0x2c, 0x50, 0x75, 0x74, 0xd5, 0x4b, 0x74, 0xc7, 0x50, 0x6e, 0x6f, 0xc4, 0x40, 0x45, 0x30, 0x74, 0x75, 0x2b, 0x49, 0x73, 0xaa, 0x40, 0x7e, 0x48, 0x63, 0x75, 0x41, 0x4f, 0xf0, 0x73, 0x61, 0x00, 0x49, 0x73, 0xb0, 0x41, 0xd8, 0x40, 0x6f, 0x4a, 0x93, 0x6e, 0x48, 0x77, 0x70, 0x41, 0xca, 0x20, 0x60, 0x42, 0xa2, 0x5a, 0x75, 0x73, 0x65, 0x33, 0x4b, 0x61, 0x99, 0x31, 0x2c, 0x94, 0x61, 0x18, 0x6f, 0x75, 0x67, 0x68, 0x07, 0x62, 0xf9, 0x41, 0x39, 0x48, 0x93, 0x64, 0x22, 0x4f, 0x74, 0xa5, 0x34, 0x4f, 0x20, 0xa6, 0x50, 0x3f, 0x94, 0x13, 0x20, 0xf5, 0x51, 0x53, 0x6f, 0x3f, 0x64, 0xc9, 0x09, 0x63, 0x30, 0x69, 0x64, 0x0c, 0x62, 0xe4, 0xf3, 0x69, 0x6e, 0x30, 0x6f, 0x77, 0x51, 0x6d, 0x69, 0x86, 0x29, 0x28, 0x02, 0x38, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0xc0, 0x43, 0x0f, 0x48, 0x63, 0x93, 0x50, 0x6c, 0x64, 0x3a, 0x68, 0x66, 0xfa, 0x64, 0xca, 0x50, 0x68, 0x6f, 0x86, 0x70, 0x64, 0x61, 0x9b, 0x50, 0x6d, 0x61, 0xbf, 0x63, 0xaa, 0x50, 0x66, 0x65, 0xd2, 0x64, 0x88, 0x71, 0x73, 0x6c, 0xe7, 0x6b, 0x79, 0xae, 0x48, 0x73, 0x1b, 0x48, 0x70, 0x9e, 0x51, 0x29, 0x2c, 0x37, 0x71, 0x65, 0x74, 0x84, 0x43, 0x37, 0x28, 0x70, 0x51, 0x61, 0x73, 0x03, 0x61, 0x65, 0xfa, 0x24, 0x0d, 0x0a, 0x6d, 0x61, 0x6b, 0x49, 0x61, 0xb3, 0x59, 0x69, 0x73, 0x79, 0x2d, 0x63, 0x68, 0x61, 0x00, 0x4a, 0x77, 0x93, 0x61, 0x2a, 0x01, 0xb6, 0x68, 0x72, 0x5c, 0x43, 0xcb, 0x30, 0x74, 0x72, 0x73, 0x62, 0x6c, 0xfe, 0x74, 0x67, 0x65, 0x31, 0x72, 0x75, 0x70, 0x4a, 0x71, 0x0d, 0x0a, 0xb4, 0x42, 0xbc, 0x62, 0xdb, 0x43, 0xba, 0x68, 0x69, 0xa9, 0x43, 0x8f, 0x50, 0x6e, 0x20, 0x9a, 0x10, 0x64, 0x64, 0xc0, 0x71, 0x6c, 0x79, 0xcb, 0x70, 0x57, 0x68, 0xe1, 0x00, 0x79, 0x1f, 0x52, 0x61, 0x62, 0x62, 0x7b, 0x62, 0xd5, 0x61, 0x7d, 0x68, 0x6e, 0x52, 0x71, 0x65, 0x79, 0x7c, 0x48, 0x72, 0xb9, 0x61, 0x7b, 0x70, 0x6c, 0x6f, 0x9f, 0x85, 0xdd, 0x6a, 0x2e, 0xd7, 0x09, 0x54, 0xbf, 0x64, 0xd8, 0x86, 0xf2, 0xe8, 0x73, 0x4a, 0x5f, 0x1e, 0x69, 0x5f, 0x2a, 0x59, 0x26, 0x6d, 0x61, 0x72, 0x6b, 0x61, 0x6f, 0x62, 0x51, 0x69, 0x74, 0x5a, 0x49, 0x3b, 0xda, 0x70, 0x72, 0x20, 0x15, 0x6c, 0x64, 0x70, 0x21, 0x42, 0xa1, 0x50, 0x69, 0x74, 0x61, 0x47, 0xca, 0x1f, 0x50, 0x6d, 0x75, 0x21, 0x69, 0x20, 0x5d, 0x42, 0x3b, 0x6b, 0x74, 0x7c, 0x8a, 0x79, 0x4f, 0x20, 0xb4, 0x6b, 0x61, 0xe7, 0x46, 0x62, 0x0c, 0x73, 0x20, 0xbf, 0x68, 0x73, 0x80, 0x89, 0x66, 0xf7, 0x50, 0x4f, 0x68, 0x1c, 0x49, 0x64, 0xdc, 0x30, 0x21, 0x20, 0xbb, 0x0c, 0x20, 0x69, 0x49, 0x6c, 0x68, 0x61, 0x63, 0x62, 0xdd, 0x50, 0x6c, 0x61, 0x28, 0x70, 0x21, 0x94, 0x50, 0x44, 0x0f, 0x00, 0xdf, 0x87, 0xe8, 0x0f, 0x49, 0x69, 0x98, 0x69, 0x76, 0x8d, 0x91, 0x61, 0x66, 0x12, 0x48, 0x77, 0xc1, 0x68, 0x64, 0xea, 0x12, 0x0d, 0x0a, 0x5f, 0x70, 0x63, 0x63, 0x83, 0xa1, 0xe6, 0x44, 0x85, 0x4b, 0x72, 0x42, 0x43, 0xc7, 0x43, 0xc9, 0x23, 0x51, 0x72, 0x61, 0x76, 0x85, 0x68, 0x6e, 0xc4, 0x42, 0xd9, 0x20, 0x42, 0x33, 0x8b, 0x73, 0xf9, 0x3e, 0x01, 0x64, 0x01, 0x60, 0x7f, 0x52, 0x6d, 0x65, 0x9e, 0x42, 0x7b, 0xa8, 0x73, 0xff, 0xf8, 0xe9, 0x6d, 0x72, 0x71, 0x75, 0x9e, 0x91, 0x6e, 0x61, 0x28, 0x20, 0x53, 0x52, 0x29, 0x3b, 0xd1, 0x63, 0x7a, 0x47, 0x25, 0x89, 0x61, 0xf1, 0x0a, 0x00, 0x61, 0x6f, 0xb2, 0x5f, 0x74, 0xf0, 0xd4, 0x48, 0x61, 0xb7, 0x48, 0x77, 0x41, 0x67, 0xeb, 0x42, 0x0d, 0x61, 0xeb, 0xa1, 0xf4, 0x61, 0x10, 0x63, 0x6f, 0x50, 0x2d, 0x70, 0x56, 0x68, 0x6b, 0x15, 0xac, 0x5f, 0xf7, 0x64, 0x49, 0x6c, 0xd0, 0x44, 0x73, 0x34, 0x69, 0x74, 0x6a, 0x74, 0x1e, 0x49, 0x68, 0x35, 0x91, 0x69, 0x65, 0xff, 0xfb, 0x40, 0x52, 0x6d, 0x2c, 0x86, 0x70, 0x73, 0x74, 0x65, 0x4b, 0x74, 0x21, 0x86, 0x68, 0x8b, 0x74, 0xf0, 0x48, 0x42, 0x51, 0x70, 0x66, 0x6c, 0x31, 0x4a, 0x68, 0x2c, 0x70, 0x63, 0x72, 0x12, 0x2a, 0x73, 0x84, 0xff, 0x12, 0x66, 0xfc, 0xb3, 0x0d, 0x0a, 0x60, 0x6a, 0x65, 0xc8, 0x51, 0x62, 0x65, 0xcb, 0x4a, 0x65, 0x22, 0xa9, 0x6e, 0xff, 0x8b, 0x8f, 0x72, 0xc6, 0x2d, 0x09, 0x65, 0x62, 0xa7, 0x47, 0x54, 0x8e, 0x8a, 0x2c, 0xdb, 0x46, 0x2b, 0x62, 0x25, 0x30, 0x74, 0x61, 0x5e, 0x45, 0x23, 0x46, 0x48, 0x61, 0xe8, 0x8a, 0x72, 0x55, 0x44, 0xb5, 0x61, 0x75, 0x91, 0x69, 0x6f, 0xef, 0x60, 0x72, 0x79, 0x2c, 0x44, 0x82, 0x76, 0x45, 0x64, 0x64, 0x99, 0x48, 0x66, 0x24, 0x74, 0x6c, 0x64, 0x3e, 0x46, 0xc0, 0x42, 0x35, 0x71, 0x74, 0x75, 0x99, 0x20, 0x3f, 0xab, 0x79, 0x3a, 0x50, 0x6a, 0x75, 0x7c, 0x82, 0xfe, 0x7a, 0x63, 0x6d, 0x71, 0x74, 0x6f, 0x71, 0x63, 0x66, 0x60, 0xc2, 0x89, 0x70, 0x44, 0x72, 0x77, 0x6e, 0x9b, 0x68, 0x6c, 0x02, 0x55, 0x67, 0x65, 0x3d, 0x99, 0x1e, 0x2d, 0x68, 0x6f, 0x6c, 0xb3, 0x62, 0x23, 0x63, 0x66, 0x61, 0xf1, 0x20, 0x2f, 0x83, 0x0f, 0x49, 0x49, 0x18, 0x81, 0xeb, 0x07, 0x63, 0xeb, 0x50, 0x6f, 0x6d, 0x0a, 0x4c, 0x74, 0xc0, 0x29, 0x77, 0x64, 0xa5, 0x47, 0x77, 0x1e, 0x64, 0xdd, 0xa3, 0xe8, 0x87, 0xe4, 0xba, 0x40, 0xa4, 0x48, 0x77, 0x92, 0xa3, 0xff, 0xee, 0xa3, 0x44, 0x96, 0x6c, 0x64, 0xee, 0x94, 0xa5, 0x67, 0x63, 0xf4, 0xb1, 0x61, 0x67, 0xff, 0x1c, 0xa5, 0x9d, 0x47, 0x6a, 0x46, 0x44, 0x95, 0x10, 0x73, 0x74, 0x89, 0x69, 0xfe, 0x76, 0xa2, 0x5f, 0x40, 0x8a, 0xe9, 0x6b, 0x49, 0x20, 0x10, 0x68, 0x6e, 0xf7, 0x63, 0x3b, 0x48, 0x73, 0x66, 0xa3, 0xff, 0xc7, 0x87, 0xfc, 0x1f, 0xa1, 0xe3, 0xb2, 0x69, 0x70, 0xef, 0x77, 0xa6, 0x12, 0x43, 0x09, 0x61, 0xb0, 0x2f, 0x6f, 0x70, 0x62, 0x20, 0x45, 0x3c, 0xa5, 0xef, 0x7f, 0x41, 0x7a, 0x46, 0x1b, 0xb4, 0x74, 0x6f, 0x53, 0x50, 0x0d, 0x0a, 0x76, 0x42, 0x61, 0x08, 0x73, 0x7f, 0x53, 0x70, 0x70, 0x33, 0xb2, 0x65, 0x72, 0x7e, 0x85, 0xfb, 0xf7, 0x43, 0x36, 0x00, 0x61, 0xc7, 0x07, 0x30, 0x89, 0x66, 0xfd, 0x35, 0x41, 0xd7, 0x65, 0x99, 0x83, 0x8b, 0xa2, 0xfe, 0x56, 0xb3, 0x65, 0x70, 0xc6, 0xef, 0x2e, 0xf0, 0xe8 }; // static const size_t lzsa_test_11_lzsa2_len = 1044;
the_stack_data/96810.c
#include <stdio.h> int main(void) { int R, A; scanf("%d %d", &R, &A); if (R == A) { if (A < 6) printf("%d+3=%d\n", A - 3, R); else printf("3+%d=%d\n", A - 3, R); } else if (A < R - A) printf("%d+%d=%d\n", A, R - A, R); else printf("%d+%d=%d\n", R - A, A, R); return 0; }
the_stack_data/266500.c
#include <stdio.h> #include <string.h> void main() { int id, unit; float chg, surchg=0, gramt,netamt; char name[25]; printf("Input Customer ID :"); scanf("%d",&id); printf("Input the name of the customer :"); scanf("%s",name); printf("Input the unit consumed by the customer : "); scanf("%d",&unit); if (unit <200 ) { chg = 1.20; } else if (unit>=200 && unit<400){ chg = 1.50; } else if (unit>=400 && unit<600){ chg = 1.80; } else { chg = 2.00; } gramt = unit * chg; if (gramt > 300) { surchg = gramt * 15 / 100.0; netamt = gramt + surchg; } if (netamt < 100) netamt = 100; printf("\nElectricity Bill\n"); printf("Customer IDNO :%d\n",id); printf("Customer Name :%s\n",name); printf("unit Consumed :%d\n",unit); printf("Amount Charges @Rs. %4.2f per unit :%8.2f\n",chg,gramt); printf("Surchage Amount :%8.2f\n",surchg); printf("Net Amount Paid By the Customer :%8.2f\n",netamt); }
the_stack_data/175142997.c
/* Copyright 2019 (c) Adam McKenney - See LICENSE for details */ /* cat but it only reads up to a certain size, and only from stdin */ /* used like: cat /dev/random | ./a.out > test.1mb.o */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define DEFAULT_SIZE 1000000 void cat(FILE *fp, size_t size){ /* loops through the file and puts the data one byte at a time into stdout until fread() returns 0 */ char p = 0; size_t i; for(i=0; i < size*sizeof(char); i++){ if(!fread(&p, 1, 1, fp) || !fwrite(&p, 1, 1, stdout)) break; //if we were unable to read or write, we are done. Size must be 1 for binary files } } int main(int argc, char *argv[]){ char size_s[11] = {'\0'}; size_t size = DEFAULT_SIZE; if(argc > 2){ fprintf(stderr, "Usage: cat foo | %s <size>\n", argv[0]); return 1; } else if(argc == 2) { strncpy(size_s, argv[1], 11); size_s[10] = '\0'; size = atol(size_s); if(size == 0){ fprintf(stderr, "%s: Invalid size '%s'\n", argv[0], argv[1]); return 1; } } fprintf(stderr, "Writing %ld bytes to stdout\n", size*sizeof(char)); cat(stdin, size); return 0; }
the_stack_data/237642990.c
#include <stdio.h> #include <ctype.h> #define BUFSIZE 100 #define SIZE 100 int getch(void); void ungetch(int c); int getint(int *pn); int main() { int n, a[SIZE]; char b; for (n = 0; n < SIZE && getint(&a[n]) != EOF; n++) ; for (n = 0; n < SIZE; n++) printf("%d\n", a[n]); return 0; } int getint(int *pn) { int c, d, sign; while (isspace(c=getch())) ; if (!isdigit(c) && c != EOF && c != '+' && c != '-'){ ungetch(c); return 0; } sign = (c == '-') ? -1 : 1; if (c == '+' || c == '-'){ d = c; if (!isdigit(c=getch())){ ungetch(c); ungetch(d); return 0; } } for (*pn = 0; isdigit(c); c = getch()) *pn = 10 * *pn + (c - '0'); *pn *= sign; if (c != EOF) ungetch(c); return c; } char buf[BUFSIZE]; int bufp = 0; int getch(void) { return (bufp > 0) ? buf[--bufp] : getchar(); } void ungetch(int c) { if (bufp >= BUFSIZE) printf("ungetch: too many characters\n"); else buf[bufp++] = c; }
the_stack_data/86075016.c
#include <stdio.h> #include <pthread.h> void* hello(void* tid) { printf("Hello from thread %d\n" , *((int*)tid) ); } int main() { pthread_t tid [10]; int i ; for ( i = 0; i < 10; i++) { pthread_create(&tid[i] , NULL, hello, (void*)&i); pthread_join(tid[i], NULL); } pthread_exit(NULL); }
the_stack_data/108061.c
/*Special thanks to pekfos from cpp0x forum for helping me and finding major bugs :) */ #include <stdio.h> #include <stdlib.h> //STACK EXERCISE void add( int * size, int stack[] ) { //adds another int to the stack //printf( "TEST: add() is running\n" ); if( * size >= 4 ) { printf( "FULL" ); system("pause"); } else { printf( "Enter an integer to add to the stack: " ); ++*size; scanf( "%d", & stack[ * size ] ); printf( "\n" ); //printf( "TEST: add() added a value\n" ); } } void delete( int * size ) { //deletes last int from a stack if( * size >= 1 ) { printf( "The last integer has been deleted\n" ); --*size; } else { printf( "STACK IS EMPTY\n" ); system( "pause" ); } } void showSize( int size ) { printf( "The stack containt %d elements\n", size ); system( "pause" ); } void isempty( size ) { printf( "The stack is not empty, number of elements: %d", size ); system( "pause" ); } int main() { int run = 1; //keeps program running if set to 1; int stack[ 5 ]; // stack[0] is counter, stack[1]-stack[5] contain stack data int control, i; int size = 0; do { //main program loop system( "cls" ); //clear the window printf( "THE STACK EXERCISE\n" ); printf( "------------------\n" ); printf( "-----CONTENT:-----\n" ); printf( "------------------\n" ); for( i = size; i >= 1; i-- ) { //prints the stack printf( "-%d-\n", stack[ i ] ); } if( size == 0 ) printf( "EMPTY\n" ); //printf empty if stack is empty printf( "------------------\n" ); printf( "------------------\n" ); printf( "\n-------MENU-------\n1.Add element\n2.Delete last element\n3.Print number of elements\n" ); printf( "4.Check if stack is empty\n5.Close app\n" ); printf( "USER INPUT: " ); scanf( "%d", & control ); //printf("TEST: CONTROL SCANF WORKS"); switch( control ) { //control switch case 1: add( & size, stack ); //printf( "TEST:1" ); break; case 2: delete( & size ); //printf("TEST:2"); break; case 3: showSize( size ); //printf("TEST:3"); break; case 4: isempty( size ); //printf("TEST:4"); break; case 5: run = 5; printf( "\n>>>CLOSING APPLICATION<<<\n" ); sleep(1); break; } } while( run == 1 ); return 0; }
the_stack_data/27296.c
/* * 家庭作业 2.89 * * 分配给你一个任务,编写一个 C 函数来计算 2^x 的浮点表示。你意识到完成这个任务的 * 最好方法是直接创建结果的 IEEE 单精度表示。当 x 太小时,你的程序将返回0.0。当 * x 太大时,它会返回 +oo。填写下列代码的空白部分,以计算出正确的结果。假设函数 * u2f 返回的浮点值与它的无符号参数有相同的位表示。 * * 对于单精度 IEEE 浮点格式,下面列出一些特殊的位模式: * * [0111 1111 1000 0000 0000 0000 0000 0000] +oo * [0000 0000 0000 0000 0000 0000 0000 0000] +0.0 * [1000 0000 0000 0000 0000 0000 0000 0000] -0.0 * [?111 1111 1??? ???? ???? ???? ???? ????] NaN * * [?000 0000 0??? ???? ???? ???? ???? ????] 非规格化数 * [?*** **** *??? ???? ???? ???? ???? ????] 规格化数(阶码域不是全 0 并且不是全 1) */ unsigned f2u(float f) { union { float f; unsigned u; } a; a.f = f; return a.u; } float u2f(unsigned x) { /* 这里假设无符号整数和单精度浮点数的位表示相同 */ union { unsigned u; float f; } a; a.u = x; return a.f; } float fpwr2(int x) { /* Result exponent and fraction */ unsigned exp, frac; unsigned u; if (x < -149) { /* Too small. Return 0.0 */ exp = 0; frac = 0; } else if (x < -126) { /* Denormalized result */ exp = 0; frac = 1 << (x + 149); } else if (x < 129) { /* Normalized result */ exp = x + 127; frac = 0; } else { /* Too big. Return +oo */ exp = 0xFF; frac = 0; } /* Pack exp and frac into 32 bits */ u = exp << 23 | frac; /* Return as float */ return u2f(u); }
the_stack_data/248581661.c
/* fips_shatest.c */ /* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL * project 2005. */ /* ==================================================================== * Copyright (c) 2005 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * [email protected]. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * ([email protected]). This product includes software written by Tim * Hudson ([email protected]). * */ #include <stdio.h> #include <ctype.h> #include <string.h> #include <openssl/bio.h> #include <openssl/evp.h> #include <openssl/err.h> #include <openssl/x509v3.h> #ifndef OPENSSL_FIPS int main(int argc, char *argv[]) { printf("No FIPS SHAXXX support\n"); return(0); } #else static int dgst_test(BIO *err, BIO *out, BIO *in); static int print_dgst(BIO *err, const EVP_MD *md, BIO *out, unsigned char *Msg, int Msglen); static int print_monte(BIO *err, const EVP_MD *md, BIO *out, unsigned char *Seed, int SeedLen); int main(int argc, char **argv) { BIO *in = NULL, *out = NULL, *err = NULL; int ret = 1; ERR_load_crypto_strings(); err = BIO_new_fp(stderr, BIO_NOCLOSE); if (!err) { fprintf(stderr, "FATAL stderr initialization error\n"); goto end; } if(!FIPS_mode_set(1)) { ERR_print_errors(err); goto end; } if (argc == 1) in = BIO_new_fp(stdin, BIO_NOCLOSE); else in = BIO_new_file(argv[1], "r"); if (argc < 2) out = BIO_new_fp(stdout, BIO_NOCLOSE); else out = BIO_new_file(argv[2], "w"); if (!in) { BIO_printf(err, "FATAL input initialization error\n"); goto end; } if (!out) { fprintf(stderr, "FATAL output initialization error\n"); goto end; } if (!dgst_test(err, out, in)) { fprintf(stderr, "FATAL digest file processing error\n"); goto end; } else ret = 0; end: if (ret && err) ERR_print_errors(err); if (in) BIO_free(in); if (out) BIO_free(out); if (err) BIO_free(err); return ret; } #define SHA_TEST_MAX_BITS 102400 #define SHA_TEST_MAXLINELEN (((SHA_TEST_MAX_BITS >> 3) * 2) + 10) int dgst_test(BIO *err, BIO *out, BIO *in) { const EVP_MD *md = NULL; char *linebuf, *olinebuf, *p, *q; char *keyword, *value; unsigned char *Msg = NULL, *Seed = NULL; long MsgLen = -1, Len = -1, SeedLen = -1; int ret = 0; int lnum = 0; olinebuf = OPENSSL_malloc(SHA_TEST_MAXLINELEN); linebuf = OPENSSL_malloc(SHA_TEST_MAXLINELEN); if (!linebuf || !olinebuf) goto error; while (BIO_gets(in, olinebuf, SHA_TEST_MAXLINELEN) > 0) { lnum++; strcpy(linebuf, olinebuf); keyword = linebuf; /* Skip leading space */ while (isspace((unsigned char)*keyword)) keyword++; /* Look for = sign */ p = strchr(linebuf, '='); /* If no = or starts with [ (for [L=20] line) just copy */ if (!p) { if (!BIO_puts(out, olinebuf)) goto error; continue; } q = p - 1; /* Remove trailing space */ while (isspace((unsigned char)*q)) *q-- = 0; *p = 0; value = p + 1; /* Remove leading space from value */ while (isspace((unsigned char)*value)) value++; /* Remove trailing space from value */ p = value + strlen(value) - 1; while (*p == '\n' || isspace((unsigned char)*p)) *p-- = 0; if (!strcmp(keyword,"[L") && *p==']') { switch (atoi(value)) { case 20: md=EVP_sha1(); break; case 28: md=EVP_sha224(); break; case 32: md=EVP_sha256(); break; case 48: md=EVP_sha384(); break; case 64: md=EVP_sha512(); break; default: goto parse_error; } } else if (!strcmp(keyword, "Len")) { if (Len != -1) goto parse_error; Len = atoi(value); if (Len < 0) goto parse_error; /* Only handle multiples of 8 bits */ if (Len & 0x7) goto parse_error; if (Len > SHA_TEST_MAX_BITS) goto parse_error; MsgLen = Len >> 3; } else if (!strcmp(keyword, "Msg")) { long tmplen; if (strlen(value) & 1) *(--value) = '0'; if (Msg) goto parse_error; Msg = string_to_hex(value, &tmplen); if (!Msg) goto parse_error; } else if (!strcmp(keyword, "Seed")) { if (strlen(value) & 1) *(--value) = '0'; if (Seed) goto parse_error; Seed = string_to_hex(value, &SeedLen); if (!Seed) goto parse_error; } else if (!strcmp(keyword, "MD")) continue; else goto parse_error; BIO_puts(out, olinebuf); if (md && Msg && (MsgLen >= 0)) { if (!print_dgst(err, md, out, Msg, MsgLen)) goto error; OPENSSL_free(Msg); Msg = NULL; MsgLen = -1; Len = -1; } else if (md && Seed && (SeedLen > 0)) { if (!print_monte(err, md, out, Seed, SeedLen)) goto error; OPENSSL_free(Seed); Seed = NULL; SeedLen = -1; } } ret = 1; error: if (olinebuf) OPENSSL_free(olinebuf); if (linebuf) OPENSSL_free(linebuf); if (Msg) OPENSSL_free(Msg); if (Seed) OPENSSL_free(Seed); return ret; parse_error: BIO_printf(err, "FATAL parse error processing line %d\n", lnum); goto error; } static int print_dgst(BIO *err, const EVP_MD *emd, BIO *out, unsigned char *Msg, int Msglen) { int i, mdlen; unsigned char md[EVP_MAX_MD_SIZE]; if (!EVP_Digest(Msg, Msglen, md, (unsigned int *)&mdlen, emd, NULL)) { BIO_puts(err, "Error calculating HASH\n"); return 0; } BIO_puts(out, "MD = "); for (i = 0; i < mdlen; i++) BIO_printf(out, "%02x", md[i]); BIO_puts(out, "\n"); return 1; } static int print_monte(BIO *err, const EVP_MD *md, BIO *out, unsigned char *Seed, int SeedLen) { unsigned int i, j, k; int ret = 0; EVP_MD_CTX ctx; unsigned char *m1, *m2, *m3, *p; unsigned int mlen, m1len, m2len, m3len; EVP_MD_CTX_init(&ctx); if (SeedLen > EVP_MAX_MD_SIZE) mlen = SeedLen; else mlen = EVP_MAX_MD_SIZE; m1 = OPENSSL_malloc(mlen); m2 = OPENSSL_malloc(mlen); m3 = OPENSSL_malloc(mlen); if (!m1 || !m2 || !m3) goto mc_error; m1len = m2len = m3len = SeedLen; memcpy(m1, Seed, SeedLen); memcpy(m2, Seed, SeedLen); memcpy(m3, Seed, SeedLen); BIO_puts(out, "\n"); for (j = 0; j < 100; j++) { for (i = 0; i < 1000; i++) { EVP_DigestInit_ex(&ctx, md, NULL); EVP_DigestUpdate(&ctx, m1, m1len); EVP_DigestUpdate(&ctx, m2, m2len); EVP_DigestUpdate(&ctx, m3, m3len); p = m1; m1 = m2; m1len = m2len; m2 = m3; m2len = m3len; m3 = p; EVP_DigestFinal_ex(&ctx, m3, &m3len); } BIO_printf(out, "COUNT = %d\n", j); BIO_puts(out, "MD = "); for (k = 0; k < m3len; k++) BIO_printf(out, "%02x", m3[k]); BIO_puts(out, "\n\n"); memcpy(m1, m3, m3len); memcpy(m2, m3, m3len); m1len = m2len = m3len; } ret = 1; mc_error: if (m1) OPENSSL_free(m1); if (m2) OPENSSL_free(m2); if (m3) OPENSSL_free(m3); EVP_MD_CTX_cleanup(&ctx); return ret; } #endif
the_stack_data/153268316.c
/************************************************************************* > File Name: sds.c > Author: > Mail: > Created Time: Tue 02 Jan 2018 12:14:59 AM PST ************************************************************************/ #include<stdio.h> #include <sys/types.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #define SDS_MAX_PERALLOC 1024 * 1024 typedef char *sds; struct sdshdr { int len; int free; char buf[]; }; size_t sdslen(const sds s) { struct sdshdr *sh = (void *)(s - (sizeof(struct sdshdr))); return sh->len; } sds sdsnewlen(size_t initlen) { struct sdshdr *sh; sh = malloc(sizeof(struct sdshdr)+initlen+1); if (sh == NULL) return NULL; sh->len = initlen; sh->free = 0; sh->buf[initlen] = '\0'; return (char*)sh->buf; } size_t sdsavail(sds s) { struct sdshdr *sh = (void *)(s - (sizeof(struct sdshdr))); return sh->free; } static sds sdsMakeRoomFor(sds s, size_t addlen) { struct sdshdr *sh, *newsh; size_t free = sdsavail(s); size_t len, newlen; if(free >= addlen) return s; len = sdslen(s); sh = (void *)(s - (sizeof(struct sdshdr))); newlen = (len + addlen); printf("old_len = %ld, newlen = %ld\n", len, newlen); if(newlen < SDS_MAX_PERALLOC) newlen *= 2; else newlen = SDS_MAX_PERALLOC; printf("newlen = %ld\n", newlen); newsh = realloc(sh, sizeof(struct sdshdr) + newlen + 1); if(newsh == NULL) return NULL; newsh->free = newlen - len; return newsh->buf; } sds sdscatlen(sds s, const void *t, size_t len) { struct sdshdr *sh; size_t curlen = sdslen(s); s = sdsMakeRoomFor(s,len); if (s == NULL) return NULL; printf("sdscatlen %ld %s\n", curlen, t); sh = (void*) (s-(sizeof(struct sdshdr))); memcpy(s+curlen, t, len); sh->len = curlen+len; sh->free = sh->free-len; s[curlen+len] = '\0'; return s; } int main() { sds s = sdsnewlen(0); s = sdscatlen(s, "hell", 4); size_t len = sdslen(s); size_t free = sdsavail(s); printf("len = %p, %ld, %ld\n", s, len, free); s = sdscatlen(s, "abcdefgabc", 10); len = sdslen(s); free = sdsavail(s); printf("len = %s, %ld, %ld\n", s, len, free); }
the_stack_data/267688.c
// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: rm -rf %t.klee-out // RUN: %klee --output-dir=%t.klee-out --libc=klee --exit-on-error %t1.bc #include <arpa/inet.h> #include <assert.h> int main() { uint32_t n = 0; klee_make_symbolic(&n, sizeof(n)); uint32_t h = ntohl(n); assert(htonl(h) == n); return 0; }
the_stack_data/173576745.c
/* A multithreaded sudoku puzzle solution checker. */ #include <stdio.h> #include <assert.h> #include <pthread.h> #define NUM_THREADS (1 + 1 + 9) // 1 row checker, 1 column checker, 9 sub-grid checkers = 11 threads. #define PUZ_SIZE 9 // A puzzle is a 9x9 grid. #define PUZ_MIN_ENTRY 1 #define PUZ_MAX_ENTRY 9 #define PUZ_SUBGRID_SIZE 3 // The sub-grids are 3x3. #define ROW_COL_SUBGRID_CHECK_PASSED (0) #define ROW_COL_SUBGRID_CHECK_FAILED (1) #define DIGIT_NOT_FOUND (0) #define DIGIT_FOUND (1) /* This struct is used to pass to each thread the information it needs to check it's part of the puzzle. */ typedef struct _sudoku_puz_t { const int (*sudoku_puz)[PUZ_SIZE]; // Points to the sudoku puzzle solution to be checked. int row; // Remaining members are used only for sub-grid checking. int col; int i; // Used for sub-grid result index. } sudoku_puz_t; /* Puzzle solution checking results. */ /* Index 0 in rowr[], colr[], subgridr[] is unused for convenience since we are interested in. For i in [1,9], rowr[i] == 0 means all digits were present in the i-th row. The meaning of colr[] and subgridr[] is analogous to that of rowr[] and correspond to the puzzle's columns and 3x3 sub-grids, respectively. */ static int rowr[PUZ_SIZE]; static int colr[PUZ_SIZE]; static int subgridr[PUZ_SIZE]; static void reset_digits_arr(int a[]) { assert(a != NULL); for (int i = 1 /* Index 0 unused. See note above. */; i < PUZ_SIZE + 1; i++) { a[i] = DIGIT_NOT_FOUND; } } /* Returns 1 if a digit was missing, otherwise, returns 0 if all digits were present. Hence, 0 means that the particular row, column, or sub-grid was valid. */ static int digit_is_missing(const int a[]) { assert(a != NULL); for (int i = 1; i < PUZ_SIZE + 1; i++) { if (a[i] == DIGIT_NOT_FOUND) return 1; } return 0; } static void *row_checker(void *param) { int digits[PUZ_SIZE + 1] = {0}; // + 1 for convenience. Index 0 unused. int i, j, d; assert(param != NULL); sudoku_puz_t *puz; puz = (sudoku_puz_t *) param; for (i = 0; i < PUZ_SIZE; i++) { for (j = 0; j < PUZ_SIZE; j++) { assert(puz->sudoku_puz[i][j] >= PUZ_MIN_ENTRY && puz->sudoku_puz[i][j] <= PUZ_MAX_ENTRY); d = puz->sudoku_puz[i][j]; digits[d] = DIGIT_FOUND; } if(digit_is_missing(digits)) // Save result. /* We could just bail here, since a single error in the puzzle solution means that the whole solution is incorrect. Keeping it this way facilitates a future improvement: reporting exactly where errors are found. */ rowr[i] = ROW_COL_SUBGRID_CHECK_FAILED; // Note: compared to the sub-grid checker, i can be a local variable here. reset_digits_arr(digits); } return NULL; } static void *col_checker(void *param) { int digits[PUZ_SIZE + 1] = {0}; int i, j, d; assert(param != NULL); sudoku_puz_t *puz; puz = (sudoku_puz_t *) param; /* The only difference compared to row_checker() is the interchange of i and j inside the inner loop, and that the results are stored in colr[] instead of rowr[]. */ for (i = 0; i < PUZ_SIZE; i++) { for (j = 0; j < PUZ_SIZE; j++) { assert(puz->sudoku_puz[j][i] >= PUZ_MIN_ENTRY && puz->sudoku_puz[j][i] <= PUZ_MAX_ENTRY); d = puz->sudoku_puz[j][i]; digits[d] = DIGIT_FOUND; } if(digit_is_missing(digits)) colr[i] = ROW_COL_SUBGRID_CHECK_FAILED; reset_digits_arr(digits); } return NULL; } static void *subgrid_checker(void *param) { int digits[PUZ_SIZE + 1] = {0}; // + 1 for convenience. int i, j, d; sudoku_puz_t *puz; assert(param != NULL); puz = (sudoku_puz_t *) param; /* To check a 3x3 sub-grid, we start at the upper left element of the sub-grid. */ for (i = 0 + puz->row; i < puz->row + PUZ_SUBGRID_SIZE; i++) { for (j = 0 + puz->col; j < puz->col + PUZ_SUBGRID_SIZE; j++) { assert(puz->sudoku_puz[i][j] >= PUZ_MIN_ENTRY && puz->sudoku_puz[i][j] <= PUZ_MAX_ENTRY); d = puz->sudoku_puz[i][j]; digits[d] = DIGIT_FOUND; } } if(digit_is_missing(digits)) // Save result. subgridr[puz->i] = ROW_COL_SUBGRID_CHECK_FAILED; // Note the use of `puz->i` as the index here. The reason is that this function checks 1 sub-grid only, compared to the row checker, which checks all rows in a single call. Using `puz->i` allows us to remember where to store the next result between calls. //reset_digits_arr(digits); // Not necessary here. This function only checks a single sub-grid at a time. return NULL; } // Returns 1 if the solution was valid. 0 if the solution contained an error. static int sol_valid(void) { int i; /* The solution is valid if all 3 result arrays contain only 0's.*/ for (int i = 0; i < PUZ_SIZE; i++) { if (rowr[i] == 1 || colr[i] == 1 || subgridr[i] == 1) return 0; } return 1; } static void reset_results_arr(void) { /* Zero out the result arrays. */ for (int i = 0; i < PUZ_SIZE; i++) { rowr[i] = ROW_COL_SUBGRID_CHECK_PASSED; // In the initial state, we assume the puzzle solution is valid. colr[i] = ROW_COL_SUBGRID_CHECK_PASSED; subgridr[i] = ROW_COL_SUBGRID_CHECK_PASSED; } } // Returns 1 if the solution was correct. 0 otherwise, the solution is incorrect. static int check_puz_sol(const int (*puz_arr)[9]) { pthread_t tid[NUM_THREADS]; pthread_attr_t attr[NUM_THREADS]; sudoku_puz_t puz[NUM_THREADS]; // Argument passed to each thread's start function. int v, i; assert(puz_arr != NULL); for (i = 0; i < NUM_THREADS; i++) pthread_attr_init(&attr[i]); /* Validate the rows. */ i = 0; // Index used to associate each thread with a corresponding element in tid[], attr[], and puz[]. puz[i].sudoku_puz = puz_arr; pthread_create(&tid[i], &attr[i], row_checker, &puz); /* Validate the columns. */ i = 1; puz[i].sudoku_puz = puz_arr; pthread_create(&tid[i], &attr[i], col_checker, &puz); /* Validate each sub-grid in the order given below. A sub-grid is identified by its upper left element index. (r,c,i = row, column, thread index). r,c,i = 0, 0, 2 r,c,i = 0, 3, 3 r,c,i = 0, 6, 4 r,c,i = 3, 0, 5 r,c,i = 3, 3, 6 r,c,i = 3, 6, 7 r,c,i = 6, 0, 8 r,c,i = 6, 3, 9 r,c,i = 6, 6, 10 */ i = 2; for (int row = 0; row < PUZ_SIZE; row += PUZ_SUBGRID_SIZE) { for (int col = 0; col < PUZ_SIZE; col += PUZ_SUBGRID_SIZE) { puz[i].sudoku_puz = puz_arr; puz[i].row = row; puz[i].col = col; puz[i].i = i - 2; // Informs the thread where to store it's validation result in subgridr[]. pthread_create(&tid[i], &attr[i], subgrid_checker, &puz[i]); i++; } } for (i = 0; i < NUM_THREADS; i++) pthread_join(tid[i], NULL); v = sol_valid(); if (v) printf("Solution is valid.\n"); else printf("Solution contains an error.\n"); reset_results_arr(); // Prepare for validating the next puzzle. return v; } static int sudoku_puz0[][PUZ_SIZE] = { {6, 2, 4, 5, 3, 9, 1, 8, 7}, {5, 1, 9, 7, 2, 8, 6, 3, 4}, {8, 3, 7, 6, 1, 4, 2, 9, 5}, {1, 4, 3, 8, 6, 5, 7, 2, 9}, {9, 5, 8, 2, 4, 7, 3, 6, 1}, {7, 6, 2, 3, 9, 1, 4, 5 ,8}, {3, 7, 1, 9, 5, 6, 8, 4, 2}, {4, 9, 6, 1, 8, 2, 5, 7, 3}, {2, 8, 5, 4, 7, 3, 9, 1, 6} }; /* [Puzzles with solutions](https://www.puzzles.ca/sudoku/). */ static int sudoku_puz1[][PUZ_SIZE] = { {2, 3, 7, 9, 1, 4, 6, 8, 5}, {8, 5, 9, 3, 2, 6, 4, 7, 1}, {1, 4, 6, 5, 7, 8, 3, 9, 2}, {5, 7, 8, 6, 3, 1, 2, 4, 9}, {6, 9, 1, 2, 4, 7, 5, 3, 8}, {3, 2, 4, 8, 9, 5, 1, 6, 7}, {4, 1, 3, 7, 5, 9, 8, 2, 6}, {9, 8, 5, 4, 6, 2, 7, 1, 3}, {7, 6, 2, 1, 8, 3, 9, 5, 4} }; /* Same as above but with the first element changed. Thus this is an incorrect solution. */ static const int sudoku_puz2[][PUZ_SIZE] = { {7, 3, 7, 9, 1, 4, 6, 8, 5}, {8, 5, 9, 3, 2, 6, 4, 7, 1}, {1, 4, 6, 5, 7, 8, 3, 9, 2}, {5, 7, 8, 6, 3, 1, 2, 4, 9}, {6, 9, 1, 2, 4, 7, 5, 3, 8}, {3, 2, 4, 8, 9, 5, 1, 6, 7}, {4, 1, 3, 7, 5, 9, 8, 2, 6}, {9, 8, 5, 4, 6, 2, 7, 1, 3}, {7, 6, 2, 1, 8, 3, 9, 5, 4} }; int main(void) { check_puz_sol(sudoku_puz0); check_puz_sol(sudoku_puz1); check_puz_sol(sudoku_puz2); return 0; }
the_stack_data/184517093.c
#include <sys/types.h> #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <dirent.h> #include <string.h> int regulares = 0; int tam = 0; void buscar(DIR *dir, char *pathname); int main(int argc, char *argv[]) { DIR *dir; printf("\nLos i-nodos son:\n"); if (argc == 2) { dir = opendir(argv[1]); buscar(dir, argv[1]); } else { dir = opendir("."); buscar(dir, "."); } printf("\nExisten %d archivos regulares con permiso x para grupo y otros\n", regulares); printf("El tamaño total ocupado por dichos archivos es %d bytes\n\n", tam); closedir(dir); } void buscar(DIR *dir, char *pathname) { struct dirent *entrada; struct stat atributos; char ruta[512]; DIR *subdir; while((entrada = readdir(dir)) != 0) { if (strcmp(entrada->d_name, ".") && strcmp(entrada->d_name, "..")) { sprintf(ruta, "%s/%s", pathname, entrada->d_name); lstat(ruta, &atributos); if (S_ISREG(atributos.st_mode) && (atributos.st_mode & S_IXGRP) && (atributos.st_mode & S_IXOTH)) { printf("%s %d\n", ruta, atributos.st_ino); regulares++; tam += atributos.st_size; } else if (S_ISDIR(atributos.st_mode)) { subdir = opendir(ruta); buscar(subdir, ruta); closedir(subdir); } } } }
the_stack_data/932406.c
/* User and Group Database Example Copyright (C) 1991-2020 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see <https://www.gnu.org/licenses/>. */ #include <grp.h> #include <pwd.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> int main (void) { uid_t me; struct passwd *my_passwd; struct group *my_group; char **members; /* Get information about the user ID. */ me = getuid (); my_passwd = getpwuid (me); if (!my_passwd) { printf ("Couldn't find out about user %d.\n", (int) me); exit (EXIT_FAILURE); } /* Print the information. */ printf ("I am %s.\n", my_passwd->pw_gecos); printf ("My login name is %s.\n", my_passwd->pw_name); printf ("My uid is %d.\n", (int) (my_passwd->pw_uid)); printf ("My home directory is %s.\n", my_passwd->pw_dir); printf ("My default shell is %s.\n", my_passwd->pw_shell); /* Get information about the default group ID. */ my_group = getgrgid (my_passwd->pw_gid); if (!my_group) { printf ("Couldn't find out about group %d.\n", (int) my_passwd->pw_gid); exit (EXIT_FAILURE); } /* Print the information. */ printf ("My default group is %s (%d).\n", my_group->gr_name, (int) (my_passwd->pw_gid)); printf ("The members of this group are:\n"); members = my_group->gr_mem; while (*members) { printf (" %s\n", *(members)); members++; } return EXIT_SUCCESS; }
the_stack_data/26700020.c
#include <stdio.h> #include <stdlib.h> __attribute__((__noreturn__)) void abort(void) { #if defined(__is_libk) // TODO: Add proper kernel panic. printf("kernel: panic: abort()\n"); #else // TODO: Abnormally terminate the process as if by SIGABRT. printf("abort()\n"); #endif while (1) { } __builtin_unreachable(); }
the_stack_data/502692.c
#include <stdio.h> #include <string.h> #define MAX_NUM 6 //Tamanho máximo de um número (incluindo o '\0') extern void RetiraSete(char *str); int main(){ char num_1[MAX_NUM], num_2[MAX_NUM]; char operador; char resultado[10]; //Resultado da operação, que terá valor máximo 10000*10000 = 100000000 (ou 10^8) scanf("%s %c %s", num_1, &operador, num_2); RetiraSete(num_1); RetiraSete(num_2); switch (operador){ case '+': sprintf(resultado, "%d", atoi(num_1) + atoi(num_2)); break; case 'x': sprintf(resultado, "%d", atoi(num_1) * atoi(num_2)); break; } RetiraSete(resultado); printf("%d\n", atoi(resultado)); return 0; } void RetiraSete(char *str){ int i; for (i = 0; str[i] != '\0'; i++) { if (str[i] == '7'){ str[i] = '0'; } } }
the_stack_data/89198967.c
#include <stdio.h> int main(void) { int n; scanf("%d", &n); int s = n-1; for(int i=0; i<n; i++) { int p = n-s; for(int j=0; j<s; j++) { printf(" "); } for(int k=0; k<p; k++) { printf("*"); } s = s-1; printf("\n"); } }
the_stack_data/264853.c
// Scott Kuhl // // select() lets you wait for up to a certain amount of time for a // file descriptor to become ready for some kind of IO. It is similar // to poll(). #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> int main(void) { // select() uses an array of bits (in datatype fd_set)---and each // bit corresponds to a file descriptor. We set the bits that // correspond to the file descriptors we want to watch. FD_SETSIZE // indicates the number of bits in in fd_set. We can't watch a // file descriptor that is >= FD_SETSIZE. See poll() for an // alternative! printf("FD_SETSIZE=%d\n", FD_SETSIZE); printf("Wait 5 seconds for select() to time out, or press a key to cause it to return before it times out.\n"); fd_set rfds; FD_ZERO(&rfds); // clear bit array. FD_SET(STDIN_FILENO, &rfds); // set bit for stdin=0 // Other functions: // FD_ISSET(int fd, fd_set *set) -- is a bit set? // FD_CLR(int fd, fd_set *set) -- clears a bit // select() will block for up to 5 seconds struct timeval tv; tv.tv_sec = 5; tv.tv_usec = 0; // microseconds // The first parameter to select() is nfds: The ONE PLUS the // number of the highest file descriptor that might be set in // rfds. // // select() will wait until a timeout occurs. Note that if we are // waiting on more than one file descriptor (i.e., there is more // than one bit enabled in the set), then select() will return // when one or more of them is ready. In this example, we are only // waiting on one fd. int retval = select(STDIN_FILENO+1, &rfds, NULL, NULL, &tv); // select() may have changed the value of tv. Linux sets it to the // remaining time that wasn't slept. Many other implementations do // not do this. The POSIX standard permits either behavior. if (retval == -1) perror("select()"); else if (retval) printf("There is data to read from the file descriptor (%d of the fds are ready).\n", retval); else printf("We timed out waiting for there to be data to read from the file descriptor.\n"); /* Try to read the bytes from stdin using read(). If we don't do * this, the message that the user typed might instead get sent to * the shell! */ if(1) // TRY THIS: Change this to 0! { char buf[1024]; read(STDIN_FILENO, buf, 1024); } exit(EXIT_SUCCESS); }
the_stack_data/165769064.c
/* Copyright (c) 2017, Fredrik A. Kristiansen All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the IKAROS Project. */ #include <string.h> void* memset(void* bufptr, int value, size_t size) { unsigned char* buf = (unsigned char*) bufptr; for (size_t i = 0; i < size; i++) buf[i] = (unsigned char) value; return bufptr; }
the_stack_data/61076449.c
#include<stdio.h> int main() { int i,n,a,b,x,y; scanf("%d",&n); for (i=1;i<=n;i++) { scanf("%d%d%d%d",&a,&b,&x,&y); a=(a+b)%2; x=(x+y)%2; if (a==x) a=0; else a=1; printf("Scenario #%d:\n%d\n\n",i,a); } return 0; }
the_stack_data/145036.c
// A Dynamic Programming based solution for 0-1 Knapsack problem #include<stdio.h> // A utility function that returns maximum of two integers int max(int a, int b) { return (a > b)? a : b; } // Returns the maximum value that can be put in a knapsack of capacity W int knapSack(int W, int wt[], int val[], int n) { int i, w; int K[n+1][W+1]; // Build table K[][] in bottom up manner for (i = 0; i <= n; i++) { for (w = 0; w <= W; w++) { if (i==0 || w==0) K[i][w] = 0; else if (wt[i-1] <= w) K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w]); else K[i][w] = K[i-1][w]; } } return K[n][W]; } int main() { int val[] = {60, 100, 120}; int wt[] = {10, 20, 30}; int W = 50; int n = sizeof(val)/sizeof(val[0]); printf("%d", knapSack(W, wt, val, n)); return 0; }
the_stack_data/45450993.c
/// Check the Even or Odd Number.. #include<stdio.h> int main() { int b,a; scanf("%d",&a); b=a&1; if(b==0) { printf("%d is the Even Number\n",a); } else { printf("%d is the Odd Number\n",a); } return 0; }
the_stack_data/896162.c
/*** * This code is a part of EvoApproxLib library (ehw.fit.vutbr.cz/approxlib) distributed under The MIT License. * When used, please cite the following article(s): V. Mrazek, Z. Vasicek, L. Sekanina, H. Jiang and J. Han, "Scalable Construction of Approximate Multipliers With Formally Guaranteed Worst Case Error" in IEEE Transactions on Very Large Scale Integration (VLSI) Systems, vol. 26, no. 11, pp. 2572-2576, Nov. 2018. doi: 10.1109/TVLSI.2018.2856362 * This file contains a circuit from a sub-set of pareto optimal circuits with respect to the pwr and ep parameters ***/ // MAE% = 0.00 % // MAE = 0 // WCE% = 0.00 % // WCE = 0 // WCRE% = 0.00 % // EP% = 0.00 % // MRE% = 0.00 % // MSE = 0 // PDK45_PWR = 1.157 mW // PDK45_AREA = 1605.0 um2 // PDK45_DELAY = 2.28 ns #include <stdint.h> #include <stdlib.h> uint32_t mul12u_342(uint16_t A, uint16_t B) { uint32_t P, P_; uint16_t tmp, C_10_0,C_10_1,C_10_10,C_10_2,C_10_3,C_10_4,C_10_5,C_10_6,C_10_7,C_10_8,C_10_9,C_11_0,C_11_1,C_11_10,C_11_2,C_11_3,C_11_4,C_11_5,C_11_6,C_11_7,C_11_8,C_11_9,C_12_0,C_12_1,C_12_10,C_12_2,C_12_3,C_12_4,C_12_5,C_12_6,C_12_7,C_12_8,C_12_9,C_1_0,C_1_1,C_1_10,C_1_2,C_1_3,C_1_4,C_1_5,C_1_6,C_1_7,C_1_8,C_1_9,C_2_0,C_2_1,C_2_10,C_2_2,C_2_3,C_2_4,C_2_5,C_2_6,C_2_7,C_2_8,C_2_9,C_3_0,C_3_1,C_3_10,C_3_2,C_3_3,C_3_4,C_3_5,C_3_6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_3,S_5_4,S_5_5,S_5_6,S_5_7,S_5_8,S_5_9,S_6_0,S_6_1,S_6_10,S_6_11,S_6_2,S_6_3,S_6_4,S_6_5,S_6_6,S_6_7,S_6_8,S_6_9,S_7_0,S_7_1,S_7_10,S_7_11,S_7_2,S_7_3,S_7_4,S_7_5,S_7_6,S_7_7,S_7_8,S_7_9,S_8_0,S_8_1,S_8_10,S_8_11,S_8_2,S_8_3,S_8_4,S_8_5,S_8_6,S_8_7,S_8_8,S_8_9,S_9_0,S_9_1,S_9_10,S_9_11,S_9_2,S_9_3,S_9_4,S_9_5,S_9_6,S_9_7,S_9_8,S_9_9; S_0_0 = (((A>>0)&1) & ((B>>0)&1)); S_0_1 = (((A>>0)&1) & ((B>>1)&1)); S_0_2 = (((A>>0)&1) & ((B>>2)&1)); S_0_3 = (((A>>0)&1) & ((B>>3)&1)); S_0_4 = (((A>>0)&1) & ((B>>4)&1)); S_0_5 = (((A>>0)&1) & ((B>>5)&1)); S_0_6 = (((A>>0)&1) & ((B>>6)&1)); S_0_7 = (((A>>0)&1) & ((B>>7)&1)); S_0_8 = (((A>>0)&1) & ((B>>8)&1)); S_0_9 = (((A>>0)&1) & ((B>>9)&1)); S_0_10 = (((A>>0)&1) & ((B>>10)&1)); S_0_11 = (((A>>0)&1) & ((B>>11)&1)); S_1_0 = S_0_1^(((A>>1)&1) & ((B>>0)&1)); C_1_0 = S_0_1&(((A>>1)&1) & ((B>>0)&1)); S_1_1 = S_0_2^(((A>>1)&1) & ((B>>1)&1)); C_1_1 = S_0_2&(((A>>1)&1) & ((B>>1)&1)); S_1_2 = S_0_3^(((A>>1)&1) & ((B>>2)&1)); C_1_2 = S_0_3&(((A>>1)&1) & ((B>>2)&1)); S_1_3 = S_0_4^(((A>>1)&1) & ((B>>3)&1)); C_1_3 = S_0_4&(((A>>1)&1) & ((B>>3)&1)); S_1_4 = S_0_5^(((A>>1)&1) & ((B>>4)&1)); C_1_4 = S_0_5&(((A>>1)&1) & ((B>>4)&1)); S_1_5 = S_0_6^(((A>>1)&1) & ((B>>5)&1)); C_1_5 = S_0_6&(((A>>1)&1) & ((B>>5)&1)); S_1_6 = S_0_7^(((A>>1)&1) & ((B>>6)&1)); C_1_6 = S_0_7&(((A>>1)&1) & ((B>>6)&1)); S_1_7 = S_0_8^(((A>>1)&1) & ((B>>7)&1)); C_1_7 = S_0_8&(((A>>1)&1) & ((B>>7)&1)); S_1_8 = S_0_9^(((A>>1)&1) & ((B>>8)&1)); C_1_8 = S_0_9&(((A>>1)&1) & ((B>>8)&1)); S_1_9 = S_0_10^(((A>>1)&1) & ((B>>9)&1)); C_1_9 = S_0_10&(((A>>1)&1) & ((B>>9)&1)); S_1_10 = S_0_11^(((A>>1)&1) & ((B>>10)&1)); C_1_10 = S_0_11&(((A>>1)&1) & ((B>>10)&1)); S_1_11 = (((A>>1)&1) & ((B>>11)&1)); tmp = S_1_1^C_1_0; S_2_0 = tmp^(((A>>2)&1) & ((B>>0)&1)); C_2_0 = (tmp&(((A>>2)&1) & ((B>>0)&1)))|(S_1_1&C_1_0); tmp = S_1_2^C_1_1; S_2_1 = tmp^(((A>>2)&1) & ((B>>1)&1)); C_2_1 = (tmp&(((A>>2)&1) & ((B>>1)&1)))|(S_1_2&C_1_1); tmp = S_1_3^C_1_2; S_2_2 = tmp^(((A>>2)&1) & ((B>>2)&1)); C_2_2 = (tmp&(((A>>2)&1) & ((B>>2)&1)))|(S_1_3&C_1_2); tmp = S_1_4^C_1_3; S_2_3 = tmp^(((A>>2)&1) & ((B>>3)&1)); C_2_3 = (tmp&(((A>>2)&1) & ((B>>3)&1)))|(S_1_4&C_1_3); tmp = S_1_5^C_1_4; S_2_4 = tmp^(((A>>2)&1) & ((B>>4)&1)); C_2_4 = (tmp&(((A>>2)&1) & ((B>>4)&1)))|(S_1_5&C_1_4); tmp = S_1_6^C_1_5; S_2_5 = tmp^(((A>>2)&1) & ((B>>5)&1)); C_2_5 = (tmp&(((A>>2)&1) & ((B>>5)&1)))|(S_1_6&C_1_5); tmp = S_1_7^C_1_6; S_2_6 = tmp^(((A>>2)&1) & ((B>>6)&1)); C_2_6 = (tmp&(((A>>2)&1) & ((B>>6)&1)))|(S_1_7&C_1_6); tmp = S_1_8^C_1_7; S_2_7 = tmp^(((A>>2)&1) & ((B>>7)&1)); C_2_7 = (tmp&(((A>>2)&1) & ((B>>7)&1)))|(S_1_8&C_1_7); tmp = S_1_9^C_1_8; S_2_8 = tmp^(((A>>2)&1) & ((B>>8)&1)); C_2_8 = (tmp&(((A>>2)&1) & ((B>>8)&1)))|(S_1_9&C_1_8); tmp = S_1_10^C_1_9; S_2_9 = tmp^(((A>>2)&1) & ((B>>9)&1)); C_2_9 = (tmp&(((A>>2)&1) & ((B>>9)&1)))|(S_1_10&C_1_9); tmp = S_1_11^C_1_10; S_2_10 = tmp^(((A>>2)&1) & ((B>>10)&1)); C_2_10 = (tmp&(((A>>2)&1) & ((B>>10)&1)))|(S_1_11&C_1_10); S_2_11 = (((A>>2)&1) & ((B>>11)&1)); tmp = S_2_1^C_2_0; S_3_0 = tmp^(((A>>3)&1) & ((B>>0)&1)); C_3_0 = (tmp&(((A>>3)&1) & ((B>>0)&1)))|(S_2_1&C_2_0); tmp = S_2_2^C_2_1; S_3_1 = tmp^(((A>>3)&1) & ((B>>1)&1)); C_3_1 = (tmp&(((A>>3)&1) & ((B>>1)&1)))|(S_2_2&C_2_1); tmp = S_2_3^C_2_2; S_3_2 = tmp^(((A>>3)&1) & ((B>>2)&1)); C_3_2 = (tmp&(((A>>3)&1) & ((B>>2)&1)))|(S_2_3&C_2_2); tmp = S_2_4^C_2_3; S_3_3 = tmp^(((A>>3)&1) & ((B>>3)&1)); C_3_3 = (tmp&(((A>>3)&1) & ((B>>3)&1)))|(S_2_4&C_2_3); tmp = S_2_5^C_2_4; S_3_4 = tmp^(((A>>3)&1) & ((B>>4)&1)); C_3_4 = (tmp&(((A>>3)&1) & ((B>>4)&1)))|(S_2_5&C_2_4); tmp = S_2_6^C_2_5; S_3_5 = tmp^(((A>>3)&1) & ((B>>5)&1)); C_3_5 = (tmp&(((A>>3)&1) & ((B>>5)&1)))|(S_2_6&C_2_5); tmp = S_2_7^C_2_6; S_3_6 = tmp^(((A>>3)&1) & ((B>>6)&1)); C_3_6 = (tmp&(((A>>3)&1) & ((B>>6)&1)))|(S_2_7&C_2_6); tmp = S_2_8^C_2_7; S_3_7 = tmp^(((A>>3)&1) & ((B>>7)&1)); C_3_7 = (tmp&(((A>>3)&1) & ((B>>7)&1)))|(S_2_8&C_2_7); tmp = S_2_9^C_2_8; S_3_8 = tmp^(((A>>3)&1) & ((B>>8)&1)); C_3_8 = (tmp&(((A>>3)&1) & ((B>>8)&1)))|(S_2_9&C_2_8); tmp = S_2_10^C_2_9; S_3_9 = tmp^(((A>>3)&1) & ((B>>9)&1)); C_3_9 = (tmp&(((A>>3)&1) & ((B>>9)&1)))|(S_2_10&C_2_9); tmp = S_2_11^C_2_10; S_3_10 = tmp^(((A>>3)&1) & ((B>>10)&1)); C_3_10 = (tmp&(((A>>3)&1) & ((B>>10)&1)))|(S_2_11&C_2_10); S_3_11 = (((A>>3)&1) & ((B>>11)&1)); tmp = S_3_1^C_3_0; S_4_0 = tmp^(((A>>4)&1) & ((B>>0)&1)); C_4_0 = (tmp&(((A>>4)&1) & ((B>>0)&1)))|(S_3_1&C_3_0); tmp = S_3_2^C_3_1; S_4_1 = tmp^(((A>>4)&1) & ((B>>1)&1)); C_4_1 = (tmp&(((A>>4)&1) & ((B>>1)&1)))|(S_3_2&C_3_1); tmp = S_3_3^C_3_2; S_4_2 = tmp^(((A>>4)&1) & ((B>>2)&1)); C_4_2 = (tmp&(((A>>4)&1) & ((B>>2)&1)))|(S_3_3&C_3_2); tmp = S_3_4^C_3_3; S_4_3 = tmp^(((A>>4)&1) & ((B>>3)&1)); C_4_3 = (tmp&(((A>>4)&1) & ((B>>3)&1)))|(S_3_4&C_3_3); tmp = S_3_5^C_3_4; S_4_4 = tmp^(((A>>4)&1) & ((B>>4)&1)); C_4_4 = (tmp&(((A>>4)&1) & ((B>>4)&1)))|(S_3_5&C_3_4); tmp = S_3_6^C_3_5; S_4_5 = tmp^(((A>>4)&1) & ((B>>5)&1)); C_4_5 = (tmp&(((A>>4)&1) & ((B>>5)&1)))|(S_3_6&C_3_5); tmp = S_3_7^C_3_6; S_4_6 = tmp^(((A>>4)&1) & ((B>>6)&1)); C_4_6 = (tmp&(((A>>4)&1) & ((B>>6)&1)))|(S_3_7&C_3_6); tmp = S_3_8^C_3_7; S_4_7 = tmp^(((A>>4)&1) & ((B>>7)&1)); C_4_7 = (tmp&(((A>>4)&1) & ((B>>7)&1)))|(S_3_8&C_3_7); tmp = S_3_9^C_3_8; S_4_8 = tmp^(((A>>4)&1) & ((B>>8)&1)); C_4_8 = (tmp&(((A>>4)&1) & ((B>>8)&1)))|(S_3_9&C_3_8); tmp = S_3_10^C_3_9; S_4_9 = tmp^(((A>>4)&1) & ((B>>9)&1)); C_4_9 = (tmp&(((A>>4)&1) & ((B>>9)&1)))|(S_3_10&C_3_9); tmp = S_3_11^C_3_10; S_4_10 = tmp^(((A>>4)&1) & ((B>>10)&1)); C_4_10 = (tmp&(((A>>4)&1) & ((B>>10)&1)))|(S_3_11&C_3_10); S_4_11 = (((A>>4)&1) & ((B>>11)&1)); tmp = S_4_1^C_4_0; S_5_0 = tmp^(((A>>5)&1) & ((B>>0)&1)); C_5_0 = (tmp&(((A>>5)&1) & ((B>>0)&1)))|(S_4_1&C_4_0); tmp = S_4_2^C_4_1; S_5_1 = tmp^(((A>>5)&1) & ((B>>1)&1)); C_5_1 = (tmp&(((A>>5)&1) & ((B>>1)&1)))|(S_4_2&C_4_1); tmp = S_4_3^C_4_2; S_5_2 = tmp^(((A>>5)&1) & ((B>>2)&1)); C_5_2 = (tmp&(((A>>5)&1) & ((B>>2)&1)))|(S_4_3&C_4_2); tmp = S_4_4^C_4_3; S_5_3 = tmp^(((A>>5)&1) & ((B>>3)&1)); C_5_3 = (tmp&(((A>>5)&1) & ((B>>3)&1)))|(S_4_4&C_4_3); tmp = S_4_5^C_4_4; S_5_4 = tmp^(((A>>5)&1) & ((B>>4)&1)); C_5_4 = (tmp&(((A>>5)&1) & ((B>>4)&1)))|(S_4_5&C_4_4); tmp = S_4_6^C_4_5; S_5_5 = tmp^(((A>>5)&1) & ((B>>5)&1)); C_5_5 = (tmp&(((A>>5)&1) & ((B>>5)&1)))|(S_4_6&C_4_5); tmp = S_4_7^C_4_6; S_5_6 = tmp^(((A>>5)&1) & ((B>>6)&1)); C_5_6 = (tmp&(((A>>5)&1) & ((B>>6)&1)))|(S_4_7&C_4_6); tmp = S_4_8^C_4_7; S_5_7 = tmp^(((A>>5)&1) & ((B>>7)&1)); C_5_7 = (tmp&(((A>>5)&1) & ((B>>7)&1)))|(S_4_8&C_4_7); tmp = S_4_9^C_4_8; S_5_8 = tmp^(((A>>5)&1) & ((B>>8)&1)); C_5_8 = (tmp&(((A>>5)&1) & ((B>>8)&1)))|(S_4_9&C_4_8); tmp = S_4_10^C_4_9; S_5_9 = tmp^(((A>>5)&1) & ((B>>9)&1)); C_5_9 = (tmp&(((A>>5)&1) & ((B>>9)&1)))|(S_4_10&C_4_9); tmp = S_4_11^C_4_10; S_5_10 = tmp^(((A>>5)&1) & ((B>>10)&1)); C_5_10 = (tmp&(((A>>5)&1) & ((B>>10)&1)))|(S_4_11&C_4_10); S_5_11 = (((A>>5)&1) & ((B>>11)&1)); tmp = S_5_1^C_5_0; S_6_0 = tmp^(((A>>6)&1) & ((B>>0)&1)); C_6_0 = (tmp&(((A>>6)&1) & ((B>>0)&1)))|(S_5_1&C_5_0); tmp = S_5_2^C_5_1; S_6_1 = tmp^(((A>>6)&1) & ((B>>1)&1)); C_6_1 = (tmp&(((A>>6)&1) & ((B>>1)&1)))|(S_5_2&C_5_1); tmp = S_5_3^C_5_2; S_6_2 = tmp^(((A>>6)&1) & ((B>>2)&1)); C_6_2 = (tmp&(((A>>6)&1) & ((B>>2)&1)))|(S_5_3&C_5_2); tmp = S_5_4^C_5_3; S_6_3 = tmp^(((A>>6)&1) & ((B>>3)&1)); C_6_3 = (tmp&(((A>>6)&1) & ((B>>3)&1)))|(S_5_4&C_5_3); tmp = S_5_5^C_5_4; S_6_4 = tmp^(((A>>6)&1) & ((B>>4)&1)); C_6_4 = (tmp&(((A>>6)&1) & ((B>>4)&1)))|(S_5_5&C_5_4); tmp = S_5_6^C_5_5; S_6_5 = tmp^(((A>>6)&1) & ((B>>5)&1)); C_6_5 = (tmp&(((A>>6)&1) & ((B>>5)&1)))|(S_5_6&C_5_5); tmp = S_5_7^C_5_6; S_6_6 = tmp^(((A>>6)&1) & ((B>>6)&1)); C_6_6 = (tmp&(((A>>6)&1) & ((B>>6)&1)))|(S_5_7&C_5_6); tmp = S_5_8^C_5_7; S_6_7 = tmp^(((A>>6)&1) & ((B>>7)&1)); C_6_7 = (tmp&(((A>>6)&1) & ((B>>7)&1)))|(S_5_8&C_5_7); tmp = S_5_9^C_5_8; S_6_8 = tmp^(((A>>6)&1) & ((B>>8)&1)); C_6_8 = (tmp&(((A>>6)&1) & ((B>>8)&1)))|(S_5_9&C_5_8); tmp = S_5_10^C_5_9; S_6_9 = tmp^(((A>>6)&1) & ((B>>9)&1)); C_6_9 = (tmp&(((A>>6)&1) & ((B>>9)&1)))|(S_5_10&C_5_9); tmp = S_5_11^C_5_10; S_6_10 = tmp^(((A>>6)&1) & ((B>>10)&1)); C_6_10 = (tmp&(((A>>6)&1) & ((B>>10)&1)))|(S_5_11&C_5_10); S_6_11 = (((A>>6)&1) & ((B>>11)&1)); tmp = S_6_1^C_6_0; S_7_0 = tmp^(((A>>7)&1) & ((B>>0)&1)); C_7_0 = (tmp&(((A>>7)&1) & ((B>>0)&1)))|(S_6_1&C_6_0); tmp = S_6_2^C_6_1; S_7_1 = tmp^(((A>>7)&1) & ((B>>1)&1)); C_7_1 = (tmp&(((A>>7)&1) & ((B>>1)&1)))|(S_6_2&C_6_1); tmp = S_6_3^C_6_2; S_7_2 = tmp^(((A>>7)&1) & ((B>>2)&1)); C_7_2 = (tmp&(((A>>7)&1) & ((B>>2)&1)))|(S_6_3&C_6_2); tmp = S_6_4^C_6_3; S_7_3 = tmp^(((A>>7)&1) & ((B>>3)&1)); C_7_3 = (tmp&(((A>>7)&1) & ((B>>3)&1)))|(S_6_4&C_6_3); tmp = S_6_5^C_6_4; S_7_4 = tmp^(((A>>7)&1) & ((B>>4)&1)); C_7_4 = (tmp&(((A>>7)&1) & ((B>>4)&1)))|(S_6_5&C_6_4); tmp = S_6_6^C_6_5; S_7_5 = tmp^(((A>>7)&1) & ((B>>5)&1)); C_7_5 = (tmp&(((A>>7)&1) & ((B>>5)&1)))|(S_6_6&C_6_5); tmp = S_6_7^C_6_6; S_7_6 = tmp^(((A>>7)&1) & ((B>>6)&1)); C_7_6 = (tmp&(((A>>7)&1) & ((B>>6)&1)))|(S_6_7&C_6_6); tmp = S_6_8^C_6_7; S_7_7 = tmp^(((A>>7)&1) & ((B>>7)&1)); C_7_7 = (tmp&(((A>>7)&1) & ((B>>7)&1)))|(S_6_8&C_6_7); tmp = S_6_9^C_6_8; S_7_8 = tmp^(((A>>7)&1) & ((B>>8)&1)); C_7_8 = (tmp&(((A>>7)&1) & ((B>>8)&1)))|(S_6_9&C_6_8); tmp = S_6_10^C_6_9; S_7_9 = tmp^(((A>>7)&1) & ((B>>9)&1)); C_7_9 = (tmp&(((A>>7)&1) & ((B>>9)&1)))|(S_6_10&C_6_9); tmp = S_6_11^C_6_10; S_7_10 = tmp^(((A>>7)&1) & ((B>>10)&1)); C_7_10 = (tmp&(((A>>7)&1) & ((B>>10)&1)))|(S_6_11&C_6_10); S_7_11 = (((A>>7)&1) & ((B>>11)&1)); tmp = S_7_1^C_7_0; S_8_0 = tmp^(((A>>8)&1) & ((B>>0)&1)); C_8_0 = (tmp&(((A>>8)&1) & ((B>>0)&1)))|(S_7_1&C_7_0); tmp = S_7_2^C_7_1; S_8_1 = tmp^(((A>>8)&1) & ((B>>1)&1)); C_8_1 = (tmp&(((A>>8)&1) & ((B>>1)&1)))|(S_7_2&C_7_1); tmp = S_7_3^C_7_2; S_8_2 = tmp^(((A>>8)&1) & ((B>>2)&1)); C_8_2 = (tmp&(((A>>8)&1) & ((B>>2)&1)))|(S_7_3&C_7_2); tmp = S_7_4^C_7_3; S_8_3 = tmp^(((A>>8)&1) & ((B>>3)&1)); C_8_3 = (tmp&(((A>>8)&1) & ((B>>3)&1)))|(S_7_4&C_7_3); tmp = S_7_5^C_7_4; S_8_4 = tmp^(((A>>8)&1) & ((B>>4)&1)); C_8_4 = (tmp&(((A>>8)&1) & ((B>>4)&1)))|(S_7_5&C_7_4); tmp = S_7_6^C_7_5; S_8_5 = tmp^(((A>>8)&1) & ((B>>5)&1)); C_8_5 = (tmp&(((A>>8)&1) & ((B>>5)&1)))|(S_7_6&C_7_5); tmp = S_7_7^C_7_6; S_8_6 = tmp^(((A>>8)&1) & ((B>>6)&1)); C_8_6 = (tmp&(((A>>8)&1) & ((B>>6)&1)))|(S_7_7&C_7_6); tmp = S_7_8^C_7_7; S_8_7 = tmp^(((A>>8)&1) & ((B>>7)&1)); C_8_7 = (tmp&(((A>>8)&1) & ((B>>7)&1)))|(S_7_8&C_7_7); tmp = S_7_9^C_7_8; S_8_8 = tmp^(((A>>8)&1) & ((B>>8)&1)); C_8_8 = (tmp&(((A>>8)&1) & ((B>>8)&1)))|(S_7_9&C_7_8); tmp = S_7_10^C_7_9; S_8_9 = tmp^(((A>>8)&1) & ((B>>9)&1)); C_8_9 = (tmp&(((A>>8)&1) & ((B>>9)&1)))|(S_7_10&C_7_9); tmp = S_7_11^C_7_10; S_8_10 = tmp^(((A>>8)&1) & ((B>>10)&1)); C_8_10 = (tmp&(((A>>8)&1) & ((B>>10)&1)))|(S_7_11&C_7_10); S_8_11 = (((A>>8)&1) & ((B>>11)&1)); tmp = S_8_1^C_8_0; S_9_0 = tmp^(((A>>9)&1) & ((B>>0)&1)); C_9_0 = (tmp&(((A>>9)&1) & ((B>>0)&1)))|(S_8_1&C_8_0); tmp = S_8_2^C_8_1; S_9_1 = tmp^(((A>>9)&1) & ((B>>1)&1)); C_9_1 = (tmp&(((A>>9)&1) & ((B>>1)&1)))|(S_8_2&C_8_1); tmp = S_8_3^C_8_2; S_9_2 = tmp^(((A>>9)&1) & ((B>>2)&1)); C_9_2 = (tmp&(((A>>9)&1) & ((B>>2)&1)))|(S_8_3&C_8_2); tmp = S_8_4^C_8_3; S_9_3 = tmp^(((A>>9)&1) & ((B>>3)&1)); C_9_3 = (tmp&(((A>>9)&1) & ((B>>3)&1)))|(S_8_4&C_8_3); tmp = S_8_5^C_8_4; S_9_4 = tmp^(((A>>9)&1) & ((B>>4)&1)); C_9_4 = (tmp&(((A>>9)&1) & ((B>>4)&1)))|(S_8_5&C_8_4); tmp = S_8_6^C_8_5; S_9_5 = tmp^(((A>>9)&1) & ((B>>5)&1)); C_9_5 = (tmp&(((A>>9)&1) & ((B>>5)&1)))|(S_8_6&C_8_5); tmp = S_8_7^C_8_6; S_9_6 = tmp^(((A>>9)&1) & ((B>>6)&1)); C_9_6 = (tmp&(((A>>9)&1) & ((B>>6)&1)))|(S_8_7&C_8_6); tmp = S_8_8^C_8_7; S_9_7 = tmp^(((A>>9)&1) & ((B>>7)&1)); C_9_7 = (tmp&(((A>>9)&1) & ((B>>7)&1)))|(S_8_8&C_8_7); tmp = S_8_9^C_8_8; S_9_8 = tmp^(((A>>9)&1) & ((B>>8)&1)); C_9_8 = (tmp&(((A>>9)&1) & ((B>>8)&1)))|(S_8_9&C_8_8); tmp = S_8_10^C_8_9; S_9_9 = tmp^(((A>>9)&1) & ((B>>9)&1)); C_9_9 = (tmp&(((A>>9)&1) & ((B>>9)&1)))|(S_8_10&C_8_9); tmp = S_8_11^C_8_10; S_9_10 = tmp^(((A>>9)&1) & ((B>>10)&1)); C_9_10 = (tmp&(((A>>9)&1) & ((B>>10)&1)))|(S_8_11&C_8_10); S_9_11 = (((A>>9)&1) & ((B>>11)&1)); tmp = S_9_1^C_9_0; S_10_0 = tmp^(((A>>10)&1) & ((B>>0)&1)); C_10_0 = (tmp&(((A>>10)&1) & ((B>>0)&1)))|(S_9_1&C_9_0); tmp = S_9_2^C_9_1; S_10_1 = tmp^(((A>>10)&1) & ((B>>1)&1)); C_10_1 = (tmp&(((A>>10)&1) & ((B>>1)&1)))|(S_9_2&C_9_1); tmp = S_9_3^C_9_2; S_10_2 = tmp^(((A>>10)&1) & ((B>>2)&1)); C_10_2 = (tmp&(((A>>10)&1) & ((B>>2)&1)))|(S_9_3&C_9_2); tmp = S_9_4^C_9_3; S_10_3 = tmp^(((A>>10)&1) & ((B>>3)&1)); C_10_3 = (tmp&(((A>>10)&1) & ((B>>3)&1)))|(S_9_4&C_9_3); tmp = S_9_5^C_9_4; S_10_4 = tmp^(((A>>10)&1) & ((B>>4)&1)); C_10_4 = (tmp&(((A>>10)&1) & ((B>>4)&1)))|(S_9_5&C_9_4); tmp = S_9_6^C_9_5; S_10_5 = tmp^(((A>>10)&1) & ((B>>5)&1)); C_10_5 = (tmp&(((A>>10)&1) & ((B>>5)&1)))|(S_9_6&C_9_5); tmp = S_9_7^C_9_6; S_10_6 = tmp^(((A>>10)&1) & ((B>>6)&1)); C_10_6 = (tmp&(((A>>10)&1) & ((B>>6)&1)))|(S_9_7&C_9_6); tmp = S_9_8^C_9_7; S_10_7 = tmp^(((A>>10)&1) & ((B>>7)&1)); C_10_7 = (tmp&(((A>>10)&1) & ((B>>7)&1)))|(S_9_8&C_9_7); tmp = S_9_9^C_9_8; S_10_8 = tmp^(((A>>10)&1) & ((B>>8)&1)); C_10_8 = (tmp&(((A>>10)&1) & ((B>>8)&1)))|(S_9_9&C_9_8); tmp = S_9_10^C_9_9; S_10_9 = tmp^(((A>>10)&1) & ((B>>9)&1)); C_10_9 = (tmp&(((A>>10)&1) & ((B>>9)&1)))|(S_9_10&C_9_9); tmp = S_9_11^C_9_10; S_10_10 = tmp^(((A>>10)&1) & ((B>>10)&1)); C_10_10 = (tmp&(((A>>10)&1) & ((B>>10)&1)))|(S_9_11&C_9_10); S_10_11 = (((A>>10)&1) & ((B>>11)&1)); tmp = S_10_1^C_10_0; S_11_0 = tmp^(((A>>11)&1) & ((B>>0)&1)); C_11_0 = (tmp&(((A>>11)&1) & ((B>>0)&1)))|(S_10_1&C_10_0); tmp = S_10_2^C_10_1; S_11_1 = tmp^(((A>>11)&1) & ((B>>1)&1)); C_11_1 = (tmp&(((A>>11)&1) & ((B>>1)&1)))|(S_10_2&C_10_1); tmp = S_10_3^C_10_2; S_11_2 = tmp^(((A>>11)&1) & ((B>>2)&1)); C_11_2 = (tmp&(((A>>11)&1) & ((B>>2)&1)))|(S_10_3&C_10_2); tmp = S_10_4^C_10_3; S_11_3 = tmp^(((A>>11)&1) & ((B>>3)&1)); C_11_3 = (tmp&(((A>>11)&1) & ((B>>3)&1)))|(S_10_4&C_10_3); tmp = S_10_5^C_10_4; S_11_4 = tmp^(((A>>11)&1) & ((B>>4)&1)); C_11_4 = (tmp&(((A>>11)&1) & ((B>>4)&1)))|(S_10_5&C_10_4); tmp = S_10_6^C_10_5; S_11_5 = tmp^(((A>>11)&1) & ((B>>5)&1)); C_11_5 = (tmp&(((A>>11)&1) & ((B>>5)&1)))|(S_10_6&C_10_5); tmp = S_10_7^C_10_6; S_11_6 = tmp^(((A>>11)&1) & ((B>>6)&1)); C_11_6 = (tmp&(((A>>11)&1) & ((B>>6)&1)))|(S_10_7&C_10_6); tmp = S_10_8^C_10_7; S_11_7 = tmp^(((A>>11)&1) & ((B>>7)&1)); C_11_7 = (tmp&(((A>>11)&1) & ((B>>7)&1)))|(S_10_8&C_10_7); tmp = S_10_9^C_10_8; S_11_8 = tmp^(((A>>11)&1) & ((B>>8)&1)); C_11_8 = (tmp&(((A>>11)&1) & ((B>>8)&1)))|(S_10_9&C_10_8); tmp = S_10_10^C_10_9; S_11_9 = tmp^(((A>>11)&1) & ((B>>9)&1)); C_11_9 = (tmp&(((A>>11)&1) & ((B>>9)&1)))|(S_10_10&C_10_9); tmp = S_10_11^C_10_10; S_11_10 = tmp^(((A>>11)&1) & ((B>>10)&1)); C_11_10 = (tmp&(((A>>11)&1) & ((B>>10)&1)))|(S_10_11&C_10_10); S_11_11 = (((A>>11)&1) & ((B>>11)&1)); S_12_0 = S_11_1^C_11_0; C_12_0 = S_11_1&C_11_0; tmp = S_11_2^C_12_0; S_12_1 = tmp^C_11_1; C_12_1 = (tmp&C_11_1)|(S_11_2&C_12_0); tmp = S_11_3^C_12_1; S_12_2 = tmp^C_11_2; C_12_2 = (tmp&C_11_2)|(S_11_3&C_12_1); tmp = S_11_4^C_12_2; S_12_3 = tmp^C_11_3; C_12_3 = (tmp&C_11_3)|(S_11_4&C_12_2); tmp = S_11_5^C_12_3; S_12_4 = tmp^C_11_4; C_12_4 = (tmp&C_11_4)|(S_11_5&C_12_3); tmp = S_11_6^C_12_4; S_12_5 = tmp^C_11_5; C_12_5 = (tmp&C_11_5)|(S_11_6&C_12_4); tmp = S_11_7^C_12_5; S_12_6 = tmp^C_11_6; C_12_6 = (tmp&C_11_6)|(S_11_7&C_12_5); tmp = S_11_8^C_12_6; S_12_7 = tmp^C_11_7; C_12_7 = (tmp&C_11_7)|(S_11_8&C_12_6); tmp = S_11_9^C_12_7; S_12_8 = tmp^C_11_8; C_12_8 = (tmp&C_11_8)|(S_11_9&C_12_7); tmp = S_11_10^C_12_8; S_12_9 = tmp^C_11_9; C_12_9 = (tmp&C_11_9)|(S_11_10&C_12_8); tmp = S_11_11^C_12_9; S_12_10 = tmp^C_11_10; C_12_10 = (tmp&C_11_10)|(S_11_11&C_12_9); S_12_11 = C_12_10; P = 0; P |= (S_0_0 & 1) << 0; P |= (S_1_0 & 1) << 1; P |= (S_2_0 & 1) << 2; P |= (S_3_0 & 1) << 3; P |= (S_4_0 & 1) << 4; P |= (S_5_0 & 1) << 5; P |= (S_6_0 & 1) << 6; P |= (S_7_0 & 1) << 7; P |= (S_8_0 & 1) << 8; P |= (S_9_0 & 1) << 9; P |= (S_10_0 & 1) << 10; P |= (S_11_0 & 1) << 11; P |= (S_12_0 & 1) << 12; P |= (S_12_1 & 1) << 13; P |= (S_12_2 & 1) << 14; P |= (S_12_3 & 1) << 15; P |= (S_12_4 & 1) << 16; P |= (S_12_5 & 1) << 17; P |= (S_12_6 & 1) << 18; P |= (S_12_7 & 1) << 19; P |= (S_12_8 & 1) << 20; P |= (S_12_9 & 1) << 21; P |= (S_12_10 & 1) << 22; P |= (S_12_11 & 1) << 23; return P; }
the_stack_data/161080289.c
/* * getc.c - read an unsigned character */ /* $Id$ */ #include <stdio.h> int (getc)(FILE *stream) { return getc(stream); }
the_stack_data/53743.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_iswhitespace.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: aulopez <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/15 15:40:00 by aulopez #+# #+# */ /* Updated: 2018/11/15 15:47:33 by aulopez ### ########.fr */ /* */ /* ************************************************************************** */ int ft_iswhitespace(char *s, int ignore_line_feed) { int i; i = 10 + (ignore_line_feed != 0); if (!s) return (1); while (*s) { if (*s != ' ' && *s != '\t' && (!(*s >= i && *s <= 13))) return (0); s++; } return (1); }
the_stack_data/179830140.c
#include <netdb.h> #include <string.h> /* do we really need all these?? */ static int idx; static const unsigned char protos[] = {"\000ip\0" "\001icmp\0" "\002igmp\0" "\003ggp\0" "\004ipencap\0" "\005st\0" "\006tcp\0" "\010egp\0" "\014pup\0" "\021udp\0" "\024hmp\0" "\026xns-idp\0" "\033rdp\0" "\035iso-tp4\0" "\044xtp\0" "\045ddp\0" "\046idpr-cmtp\0" "\051ipv6\0" "\053ipv6-route\0" "\054ipv6-frag\0" "\055idrp\0" "\056rsvp\0" "\057gre\0" "\062esp\0" "\063ah\0" "\071skip\0" "\072ipv6-icmp\0" "\073ipv6-nonxt\0" "\074ipv6-opts\0" "\111rspf\0" "\121vmtp\0" "\131ospf\0" "\136ipip\0" "\142encap\0" "\147pim\0" "\377raw"}; void endprotoent(void) { idx = 0; } void setprotoent(int stayopen) { idx = 0; } struct protoent* getprotoent(void) { static struct protoent p; static const char* aliases; if (idx >= sizeof protos) return NULL; p.p_proto = protos[idx]; p.p_name = (char*)&protos[idx + 1]; p.p_aliases = (char**)&aliases; idx += strlen(p.p_name) + 2; return &p; } struct protoent* getprotobyname(const char* name) { struct protoent* p; endprotoent(); do p = getprotoent(); while (p && strcmp(name, p->p_name)); return p; } struct protoent* getprotobynumber(int num) { struct protoent* p; endprotoent(); do p = getprotoent(); while (p && p->p_proto != num); return p; }
the_stack_data/74005.c
struct a { long b; long c; int *batch; int *d }; struct { long b; long c } e; f, g, h, i; j() { struct a a; f || 0; k(a); a.b = e.b; a.c = e.c; if (h) l(); if (h & g) i = m(); if (i) a.d = a.batch; }
the_stack_data/87636964.c
#include <stdio.h> void scilab_rt_barh_i2_(int in00, int in01, int matrixin0[in00][in01]) { int i; int j; int val0 = 0; for (i = 0; i < in00; ++i) { for (j = 0; j < in01; ++j) { val0 += matrixin0[i][j]; } } printf("%d", val0); }
the_stack_data/553952.c
void dummyfunc() { }
the_stack_data/94543.c
#include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <limits.h> #include <stdbool.h> unsigned long long output[100000]; int main(){ int t; scanf("%d",&t); for(int a0 = 0; a0 < t; a0++){ int n; scanf("%d",&n); n --; unsigned long long cnt = 0; unsigned long long sum = 0; // sum of multiple of 3 cnt = n / 3; if (1 <= cnt) { sum = (cnt + 1) * 3 * cnt / 2; } // sum of multiple of 5 cnt = n / 5; if (1 <= cnt) { sum += (cnt + 1) * 5 * cnt / 2; } // sum of multiple of 15 cnt = n / 15; if (1 <= cnt) { sum -= (cnt + 1) * 15 * cnt / 2; } output[a0] = sum; } for(int a0 = 0; a0 < t; a0++){ printf("%llu\n", output[a0]); } return 0; }
the_stack_data/218894199.c
#include<stdio.h> #include<stdlib.h> int c; struct node { int data; struct node *next; struct node *prev; }; struct node *head=NULL,*temp,*newnode; void create() { newnode=(struct node*)malloc(sizeof(struct node)); printf("Enter the data.\n"); scanf("%d",&newnode->data); newnode->next=NULL; newnode->prev=NULL; if(head==NULL) { head=newnode; } else { temp=head; while(temp->next!=NULL) { temp=temp->next; } temp->next=newnode; newnode->prev=temp; } } void display() { temp=head; if(head==NULL) { printf("List is empty.\n"); } else { while(temp!=NULL) { printf("%d ",temp->data); temp=temp->next; } } } void insert_beg() { newnode=(struct node*)malloc(sizeof(struct node)); printf("Enter the data: \n"); scanf("%d",&newnode->data); newnode->prev=NULL; newnode->next=head; head->prev=newnode; head=newnode; } void count() { int count=0; struct node *p; p=head; if(head==NULL) { printf("The list is empty.\n"); } else { while(p!=0) { count++; p=p->next; } printf("The length of the list is %d",count); c=count; } } void insert() { int pos,i=0; printf("Enter the position after which you want enter the data:\n"); scanf("%d",&pos); if(pos>c) { printf("Enter a valid position.\n"); } else { struct node *prevnode,*nextnode; nextnode=head; newnode=(struct node*)malloc(sizeof(struct node)); printf("Enter the data:\n"); scanf("%d",&newnode->data); while(i!=pos) { prevnode=nextnode; nextnode=nextnode->next; i++; } newnode->next=nextnode; nextnode->prev=newnode; prevnode->next=newnode; newnode->prev=prevnode; } } void del_beg() { if(head==NULL) { printf("There are no elements in the list that can be deleted.\n"); } else { temp=head; head=head->next; temp->next=NULL; head->prev=NULL; free(temp); } } /*void reverse() { struct node *p; p=head; temp=head; while(temp->next!=NULL) { temp=temp->next; } head =temp; while(temp->prev!=NULL) { temp-> } } */ int main() { int choice; printf("1) Press 1 for entering the data.\n"); printf("2) Press 2 for printing the data.\n"); printf("3) Press 3 to insert data in the beginning.\n"); printf("4) Press 4 to get the length of the list.\n"); printf("5) Press 5 to insert data in a specific position.\n"); printf("6) Press 6 to delete from beginning.\n"); printf("7) Press 7 to exit.\n"); while(choice!=7) { printf("\nEnter your choice\n"); scanf("%d",&choice); switch(choice) { case 1: { create(); break; } case 2: { display(); break; } case 3: { insert_beg(); break; } case 4: { count(); break; } case 5: { insert(); break; } case 6: { del_beg(); break; } case 7: { exit(0); break; } default: { printf("Enter a valid choice.\n"); } } } }
the_stack_data/672137.c
extern float __VERIFIER_nondet_float(void); extern int __VERIFIER_nondet_int(void); typedef enum {false, true} bool; bool __VERIFIER_nondet_bool(void) { return __VERIFIER_nondet_int() != 0; } int main() { bool _J1308, _x__J1308; bool _J1300, _x__J1300; bool _J1293, _x__J1293; bool _EL_U_1274, _x__EL_U_1274; float x_18, _x_x_18; float x_15, _x_x_15; float x_17, _x_x_17; bool _EL_U_1275, _x__EL_U_1275; bool _EL_U_1272, _x__EL_U_1272; float x_13, _x_x_13; float x_0, _x_x_0; float x_19, _x_x_19; float x_1, _x_x_1; float x_5, _x_x_5; float x_3, _x_x_3; float x_6, _x_x_6; float x_10, _x_x_10; float x_4, _x_x_4; float x_8, _x_x_8; float x_9, _x_x_9; float x_11, _x_x_11; float x_12, _x_x_12; float x_14, _x_x_14; float x_16, _x_x_16; float x_2, _x_x_2; float x_7, _x_x_7; int __steps_to_fair = __VERIFIER_nondet_int(); _J1308 = __VERIFIER_nondet_bool(); _J1300 = __VERIFIER_nondet_bool(); _J1293 = __VERIFIER_nondet_bool(); _EL_U_1274 = __VERIFIER_nondet_bool(); x_18 = __VERIFIER_nondet_float(); x_15 = __VERIFIER_nondet_float(); x_17 = __VERIFIER_nondet_float(); _EL_U_1275 = __VERIFIER_nondet_bool(); _EL_U_1272 = __VERIFIER_nondet_bool(); x_13 = __VERIFIER_nondet_float(); x_0 = __VERIFIER_nondet_float(); x_19 = __VERIFIER_nondet_float(); x_1 = __VERIFIER_nondet_float(); x_5 = __VERIFIER_nondet_float(); x_3 = __VERIFIER_nondet_float(); x_6 = __VERIFIER_nondet_float(); x_10 = __VERIFIER_nondet_float(); x_4 = __VERIFIER_nondet_float(); x_8 = __VERIFIER_nondet_float(); x_9 = __VERIFIER_nondet_float(); x_11 = __VERIFIER_nondet_float(); x_12 = __VERIFIER_nondet_float(); x_14 = __VERIFIER_nondet_float(); x_16 = __VERIFIER_nondet_float(); x_2 = __VERIFIER_nondet_float(); x_7 = __VERIFIER_nondet_float(); bool __ok = (1 && (((( !(( !(( !(-7.0 <= (x_0 + (-1.0 * x_13)))) || _EL_U_1272)) || (_EL_U_1275 && (((x_17 + (-1.0 * x_18)) <= 1.0) || _EL_U_1274)))) && ( !_J1293)) && ( !_J1300)) && ( !_J1308))); while (__steps_to_fair >= 0 && __ok) { if (((_J1293 && _J1300) && _J1308)) { __steps_to_fair = __VERIFIER_nondet_int(); } else { __steps_to_fair--; } _x__J1308 = __VERIFIER_nondet_bool(); _x__J1300 = __VERIFIER_nondet_bool(); _x__J1293 = __VERIFIER_nondet_bool(); _x__EL_U_1274 = __VERIFIER_nondet_bool(); _x_x_18 = __VERIFIER_nondet_float(); _x_x_15 = __VERIFIER_nondet_float(); _x_x_17 = __VERIFIER_nondet_float(); _x__EL_U_1275 = __VERIFIER_nondet_bool(); _x__EL_U_1272 = __VERIFIER_nondet_bool(); _x_x_13 = __VERIFIER_nondet_float(); _x_x_0 = __VERIFIER_nondet_float(); _x_x_19 = __VERIFIER_nondet_float(); _x_x_1 = __VERIFIER_nondet_float(); _x_x_5 = __VERIFIER_nondet_float(); _x_x_3 = __VERIFIER_nondet_float(); _x_x_6 = __VERIFIER_nondet_float(); _x_x_10 = __VERIFIER_nondet_float(); _x_x_4 = __VERIFIER_nondet_float(); _x_x_8 = __VERIFIER_nondet_float(); _x_x_9 = __VERIFIER_nondet_float(); _x_x_11 = __VERIFIER_nondet_float(); _x_x_12 = __VERIFIER_nondet_float(); _x_x_14 = __VERIFIER_nondet_float(); _x_x_16 = __VERIFIER_nondet_float(); _x_x_2 = __VERIFIER_nondet_float(); _x_x_7 = __VERIFIER_nondet_float(); __ok = ((((((((((((((((((((((((x_17 + (-1.0 * _x_x_0)) <= -17.0) && (((x_16 + (-1.0 * _x_x_0)) <= -15.0) && (((x_14 + (-1.0 * _x_x_0)) <= -11.0) && (((x_13 + (-1.0 * _x_x_0)) <= -19.0) && (((x_10 + (-1.0 * _x_x_0)) <= -15.0) && (((x_9 + (-1.0 * _x_x_0)) <= -3.0) && (((x_8 + (-1.0 * _x_x_0)) <= -10.0) && (((x_6 + (-1.0 * _x_x_0)) <= -4.0) && (((x_1 + (-1.0 * _x_x_0)) <= -1.0) && ((x_3 + (-1.0 * _x_x_0)) <= -3.0)))))))))) && (((x_17 + (-1.0 * _x_x_0)) == -17.0) || (((x_16 + (-1.0 * _x_x_0)) == -15.0) || (((x_14 + (-1.0 * _x_x_0)) == -11.0) || (((x_13 + (-1.0 * _x_x_0)) == -19.0) || (((x_10 + (-1.0 * _x_x_0)) == -15.0) || (((x_9 + (-1.0 * _x_x_0)) == -3.0) || (((x_8 + (-1.0 * _x_x_0)) == -10.0) || (((x_6 + (-1.0 * _x_x_0)) == -4.0) || (((x_1 + (-1.0 * _x_x_0)) == -1.0) || ((x_3 + (-1.0 * _x_x_0)) == -3.0))))))))))) && ((((x_18 + (-1.0 * _x_x_1)) <= -20.0) && (((x_16 + (-1.0 * _x_x_1)) <= -17.0) && (((x_13 + (-1.0 * _x_x_1)) <= -2.0) && (((x_11 + (-1.0 * _x_x_1)) <= -4.0) && (((x_10 + (-1.0 * _x_x_1)) <= -2.0) && (((x_8 + (-1.0 * _x_x_1)) <= -6.0) && (((x_6 + (-1.0 * _x_x_1)) <= -18.0) && (((x_5 + (-1.0 * _x_x_1)) <= -20.0) && (((x_0 + (-1.0 * _x_x_1)) <= -20.0) && ((x_4 + (-1.0 * _x_x_1)) <= -2.0)))))))))) && (((x_18 + (-1.0 * _x_x_1)) == -20.0) || (((x_16 + (-1.0 * _x_x_1)) == -17.0) || (((x_13 + (-1.0 * _x_x_1)) == -2.0) || (((x_11 + (-1.0 * _x_x_1)) == -4.0) || (((x_10 + (-1.0 * _x_x_1)) == -2.0) || (((x_8 + (-1.0 * _x_x_1)) == -6.0) || (((x_6 + (-1.0 * _x_x_1)) == -18.0) || (((x_5 + (-1.0 * _x_x_1)) == -20.0) || (((x_0 + (-1.0 * _x_x_1)) == -20.0) || ((x_4 + (-1.0 * _x_x_1)) == -2.0)))))))))))) && ((((x_18 + (-1.0 * _x_x_2)) <= -15.0) && (((x_17 + (-1.0 * _x_x_2)) <= -10.0) && (((x_13 + (-1.0 * _x_x_2)) <= -20.0) && (((x_12 + (-1.0 * _x_x_2)) <= -9.0) && (((x_9 + (-1.0 * _x_x_2)) <= -11.0) && (((x_8 + (-1.0 * _x_x_2)) <= -1.0) && (((x_5 + (-1.0 * _x_x_2)) <= -3.0) && (((x_4 + (-1.0 * _x_x_2)) <= -13.0) && (((x_0 + (-1.0 * _x_x_2)) <= -12.0) && ((x_1 + (-1.0 * _x_x_2)) <= -12.0)))))))))) && (((x_18 + (-1.0 * _x_x_2)) == -15.0) || (((x_17 + (-1.0 * _x_x_2)) == -10.0) || (((x_13 + (-1.0 * _x_x_2)) == -20.0) || (((x_12 + (-1.0 * _x_x_2)) == -9.0) || (((x_9 + (-1.0 * _x_x_2)) == -11.0) || (((x_8 + (-1.0 * _x_x_2)) == -1.0) || (((x_5 + (-1.0 * _x_x_2)) == -3.0) || (((x_4 + (-1.0 * _x_x_2)) == -13.0) || (((x_0 + (-1.0 * _x_x_2)) == -12.0) || ((x_1 + (-1.0 * _x_x_2)) == -12.0)))))))))))) && ((((x_16 + (-1.0 * _x_x_3)) <= -2.0) && (((x_15 + (-1.0 * _x_x_3)) <= -12.0) && (((x_14 + (-1.0 * _x_x_3)) <= -2.0) && (((x_13 + (-1.0 * _x_x_3)) <= -13.0) && (((x_11 + (-1.0 * _x_x_3)) <= -19.0) && (((x_8 + (-1.0 * _x_x_3)) <= -16.0) && (((x_7 + (-1.0 * _x_x_3)) <= -10.0) && (((x_6 + (-1.0 * _x_x_3)) <= -7.0) && (((x_0 + (-1.0 * _x_x_3)) <= -7.0) && ((x_3 + (-1.0 * _x_x_3)) <= -13.0)))))))))) && (((x_16 + (-1.0 * _x_x_3)) == -2.0) || (((x_15 + (-1.0 * _x_x_3)) == -12.0) || (((x_14 + (-1.0 * _x_x_3)) == -2.0) || (((x_13 + (-1.0 * _x_x_3)) == -13.0) || (((x_11 + (-1.0 * _x_x_3)) == -19.0) || (((x_8 + (-1.0 * _x_x_3)) == -16.0) || (((x_7 + (-1.0 * _x_x_3)) == -10.0) || (((x_6 + (-1.0 * _x_x_3)) == -7.0) || (((x_0 + (-1.0 * _x_x_3)) == -7.0) || ((x_3 + (-1.0 * _x_x_3)) == -13.0)))))))))))) && ((((x_19 + (-1.0 * _x_x_4)) <= -2.0) && (((x_18 + (-1.0 * _x_x_4)) <= -15.0) && (((x_17 + (-1.0 * _x_x_4)) <= -17.0) && (((x_13 + (-1.0 * _x_x_4)) <= -3.0) && (((x_12 + (-1.0 * _x_x_4)) <= -17.0) && (((x_9 + (-1.0 * _x_x_4)) <= -6.0) && (((x_8 + (-1.0 * _x_x_4)) <= -12.0) && (((x_5 + (-1.0 * _x_x_4)) <= -19.0) && (((x_2 + (-1.0 * _x_x_4)) <= -9.0) && ((x_3 + (-1.0 * _x_x_4)) <= -16.0)))))))))) && (((x_19 + (-1.0 * _x_x_4)) == -2.0) || (((x_18 + (-1.0 * _x_x_4)) == -15.0) || (((x_17 + (-1.0 * _x_x_4)) == -17.0) || (((x_13 + (-1.0 * _x_x_4)) == -3.0) || (((x_12 + (-1.0 * _x_x_4)) == -17.0) || (((x_9 + (-1.0 * _x_x_4)) == -6.0) || (((x_8 + (-1.0 * _x_x_4)) == -12.0) || (((x_5 + (-1.0 * _x_x_4)) == -19.0) || (((x_2 + (-1.0 * _x_x_4)) == -9.0) || ((x_3 + (-1.0 * _x_x_4)) == -16.0)))))))))))) && ((((x_18 + (-1.0 * _x_x_5)) <= -2.0) && (((x_16 + (-1.0 * _x_x_5)) <= -13.0) && (((x_12 + (-1.0 * _x_x_5)) <= -14.0) && (((x_11 + (-1.0 * _x_x_5)) <= -12.0) && (((x_10 + (-1.0 * _x_x_5)) <= -7.0) && (((x_9 + (-1.0 * _x_x_5)) <= -5.0) && (((x_5 + (-1.0 * _x_x_5)) <= -14.0) && (((x_4 + (-1.0 * _x_x_5)) <= -8.0) && (((x_0 + (-1.0 * _x_x_5)) <= -13.0) && ((x_2 + (-1.0 * _x_x_5)) <= -10.0)))))))))) && (((x_18 + (-1.0 * _x_x_5)) == -2.0) || (((x_16 + (-1.0 * _x_x_5)) == -13.0) || (((x_12 + (-1.0 * _x_x_5)) == -14.0) || (((x_11 + (-1.0 * _x_x_5)) == -12.0) || (((x_10 + (-1.0 * _x_x_5)) == -7.0) || (((x_9 + (-1.0 * _x_x_5)) == -5.0) || (((x_5 + (-1.0 * _x_x_5)) == -14.0) || (((x_4 + (-1.0 * _x_x_5)) == -8.0) || (((x_0 + (-1.0 * _x_x_5)) == -13.0) || ((x_2 + (-1.0 * _x_x_5)) == -10.0)))))))))))) && ((((x_17 + (-1.0 * _x_x_6)) <= -1.0) && (((x_15 + (-1.0 * _x_x_6)) <= -15.0) && (((x_12 + (-1.0 * _x_x_6)) <= -13.0) && (((x_8 + (-1.0 * _x_x_6)) <= -16.0) && (((x_7 + (-1.0 * _x_x_6)) <= -9.0) && (((x_5 + (-1.0 * _x_x_6)) <= -11.0) && (((x_4 + (-1.0 * _x_x_6)) <= -9.0) && (((x_3 + (-1.0 * _x_x_6)) <= -6.0) && (((x_0 + (-1.0 * _x_x_6)) <= -16.0) && ((x_1 + (-1.0 * _x_x_6)) <= -10.0)))))))))) && (((x_17 + (-1.0 * _x_x_6)) == -1.0) || (((x_15 + (-1.0 * _x_x_6)) == -15.0) || (((x_12 + (-1.0 * _x_x_6)) == -13.0) || (((x_8 + (-1.0 * _x_x_6)) == -16.0) || (((x_7 + (-1.0 * _x_x_6)) == -9.0) || (((x_5 + (-1.0 * _x_x_6)) == -11.0) || (((x_4 + (-1.0 * _x_x_6)) == -9.0) || (((x_3 + (-1.0 * _x_x_6)) == -6.0) || (((x_0 + (-1.0 * _x_x_6)) == -16.0) || ((x_1 + (-1.0 * _x_x_6)) == -10.0)))))))))))) && ((((x_19 + (-1.0 * _x_x_7)) <= -6.0) && (((x_14 + (-1.0 * _x_x_7)) <= -10.0) && (((x_12 + (-1.0 * _x_x_7)) <= -8.0) && (((x_11 + (-1.0 * _x_x_7)) <= -12.0) && (((x_8 + (-1.0 * _x_x_7)) <= -2.0) && (((x_7 + (-1.0 * _x_x_7)) <= -10.0) && (((x_4 + (-1.0 * _x_x_7)) <= -2.0) && (((x_2 + (-1.0 * _x_x_7)) <= -19.0) && (((x_0 + (-1.0 * _x_x_7)) <= -6.0) && ((x_1 + (-1.0 * _x_x_7)) <= -5.0)))))))))) && (((x_19 + (-1.0 * _x_x_7)) == -6.0) || (((x_14 + (-1.0 * _x_x_7)) == -10.0) || (((x_12 + (-1.0 * _x_x_7)) == -8.0) || (((x_11 + (-1.0 * _x_x_7)) == -12.0) || (((x_8 + (-1.0 * _x_x_7)) == -2.0) || (((x_7 + (-1.0 * _x_x_7)) == -10.0) || (((x_4 + (-1.0 * _x_x_7)) == -2.0) || (((x_2 + (-1.0 * _x_x_7)) == -19.0) || (((x_0 + (-1.0 * _x_x_7)) == -6.0) || ((x_1 + (-1.0 * _x_x_7)) == -5.0)))))))))))) && ((((x_19 + (-1.0 * _x_x_8)) <= -7.0) && (((x_17 + (-1.0 * _x_x_8)) <= -4.0) && (((x_16 + (-1.0 * _x_x_8)) <= -15.0) && (((x_12 + (-1.0 * _x_x_8)) <= -9.0) && (((x_10 + (-1.0 * _x_x_8)) <= -18.0) && (((x_9 + (-1.0 * _x_x_8)) <= -10.0) && (((x_8 + (-1.0 * _x_x_8)) <= -11.0) && (((x_7 + (-1.0 * _x_x_8)) <= -10.0) && (((x_4 + (-1.0 * _x_x_8)) <= -7.0) && ((x_6 + (-1.0 * _x_x_8)) <= -8.0)))))))))) && (((x_19 + (-1.0 * _x_x_8)) == -7.0) || (((x_17 + (-1.0 * _x_x_8)) == -4.0) || (((x_16 + (-1.0 * _x_x_8)) == -15.0) || (((x_12 + (-1.0 * _x_x_8)) == -9.0) || (((x_10 + (-1.0 * _x_x_8)) == -18.0) || (((x_9 + (-1.0 * _x_x_8)) == -10.0) || (((x_8 + (-1.0 * _x_x_8)) == -11.0) || (((x_7 + (-1.0 * _x_x_8)) == -10.0) || (((x_4 + (-1.0 * _x_x_8)) == -7.0) || ((x_6 + (-1.0 * _x_x_8)) == -8.0)))))))))))) && ((((x_19 + (-1.0 * _x_x_9)) <= -4.0) && (((x_15 + (-1.0 * _x_x_9)) <= -13.0) && (((x_14 + (-1.0 * _x_x_9)) <= -3.0) && (((x_13 + (-1.0 * _x_x_9)) <= -3.0) && (((x_11 + (-1.0 * _x_x_9)) <= -8.0) && (((x_10 + (-1.0 * _x_x_9)) <= -15.0) && (((x_9 + (-1.0 * _x_x_9)) <= -3.0) && (((x_7 + (-1.0 * _x_x_9)) <= -13.0) && (((x_4 + (-1.0 * _x_x_9)) <= -10.0) && ((x_5 + (-1.0 * _x_x_9)) <= -5.0)))))))))) && (((x_19 + (-1.0 * _x_x_9)) == -4.0) || (((x_15 + (-1.0 * _x_x_9)) == -13.0) || (((x_14 + (-1.0 * _x_x_9)) == -3.0) || (((x_13 + (-1.0 * _x_x_9)) == -3.0) || (((x_11 + (-1.0 * _x_x_9)) == -8.0) || (((x_10 + (-1.0 * _x_x_9)) == -15.0) || (((x_9 + (-1.0 * _x_x_9)) == -3.0) || (((x_7 + (-1.0 * _x_x_9)) == -13.0) || (((x_4 + (-1.0 * _x_x_9)) == -10.0) || ((x_5 + (-1.0 * _x_x_9)) == -5.0)))))))))))) && ((((x_17 + (-1.0 * _x_x_10)) <= -10.0) && (((x_16 + (-1.0 * _x_x_10)) <= -18.0) && (((x_13 + (-1.0 * _x_x_10)) <= -12.0) && (((x_10 + (-1.0 * _x_x_10)) <= -17.0) && (((x_9 + (-1.0 * _x_x_10)) <= -1.0) && (((x_8 + (-1.0 * _x_x_10)) <= -10.0) && (((x_4 + (-1.0 * _x_x_10)) <= -6.0) && (((x_2 + (-1.0 * _x_x_10)) <= -15.0) && (((x_0 + (-1.0 * _x_x_10)) <= -6.0) && ((x_1 + (-1.0 * _x_x_10)) <= -6.0)))))))))) && (((x_17 + (-1.0 * _x_x_10)) == -10.0) || (((x_16 + (-1.0 * _x_x_10)) == -18.0) || (((x_13 + (-1.0 * _x_x_10)) == -12.0) || (((x_10 + (-1.0 * _x_x_10)) == -17.0) || (((x_9 + (-1.0 * _x_x_10)) == -1.0) || (((x_8 + (-1.0 * _x_x_10)) == -10.0) || (((x_4 + (-1.0 * _x_x_10)) == -6.0) || (((x_2 + (-1.0 * _x_x_10)) == -15.0) || (((x_0 + (-1.0 * _x_x_10)) == -6.0) || ((x_1 + (-1.0 * _x_x_10)) == -6.0)))))))))))) && ((((x_18 + (-1.0 * _x_x_11)) <= -14.0) && (((x_17 + (-1.0 * _x_x_11)) <= -17.0) && (((x_16 + (-1.0 * _x_x_11)) <= -9.0) && (((x_15 + (-1.0 * _x_x_11)) <= -7.0) && (((x_13 + (-1.0 * _x_x_11)) <= -19.0) && (((x_9 + (-1.0 * _x_x_11)) <= -16.0) && (((x_7 + (-1.0 * _x_x_11)) <= -20.0) && (((x_6 + (-1.0 * _x_x_11)) <= -19.0) && (((x_2 + (-1.0 * _x_x_11)) <= -2.0) && ((x_4 + (-1.0 * _x_x_11)) <= -20.0)))))))))) && (((x_18 + (-1.0 * _x_x_11)) == -14.0) || (((x_17 + (-1.0 * _x_x_11)) == -17.0) || (((x_16 + (-1.0 * _x_x_11)) == -9.0) || (((x_15 + (-1.0 * _x_x_11)) == -7.0) || (((x_13 + (-1.0 * _x_x_11)) == -19.0) || (((x_9 + (-1.0 * _x_x_11)) == -16.0) || (((x_7 + (-1.0 * _x_x_11)) == -20.0) || (((x_6 + (-1.0 * _x_x_11)) == -19.0) || (((x_2 + (-1.0 * _x_x_11)) == -2.0) || ((x_4 + (-1.0 * _x_x_11)) == -20.0)))))))))))) && ((((x_19 + (-1.0 * _x_x_12)) <= -13.0) && (((x_18 + (-1.0 * _x_x_12)) <= -10.0) && (((x_16 + (-1.0 * _x_x_12)) <= -13.0) && (((x_14 + (-1.0 * _x_x_12)) <= -2.0) && (((x_13 + (-1.0 * _x_x_12)) <= -18.0) && (((x_11 + (-1.0 * _x_x_12)) <= -2.0) && (((x_7 + (-1.0 * _x_x_12)) <= -18.0) && (((x_4 + (-1.0 * _x_x_12)) <= -5.0) && (((x_0 + (-1.0 * _x_x_12)) <= -7.0) && ((x_1 + (-1.0 * _x_x_12)) <= -13.0)))))))))) && (((x_19 + (-1.0 * _x_x_12)) == -13.0) || (((x_18 + (-1.0 * _x_x_12)) == -10.0) || (((x_16 + (-1.0 * _x_x_12)) == -13.0) || (((x_14 + (-1.0 * _x_x_12)) == -2.0) || (((x_13 + (-1.0 * _x_x_12)) == -18.0) || (((x_11 + (-1.0 * _x_x_12)) == -2.0) || (((x_7 + (-1.0 * _x_x_12)) == -18.0) || (((x_4 + (-1.0 * _x_x_12)) == -5.0) || (((x_0 + (-1.0 * _x_x_12)) == -7.0) || ((x_1 + (-1.0 * _x_x_12)) == -13.0)))))))))))) && ((((x_18 + (-1.0 * _x_x_13)) <= -12.0) && (((x_15 + (-1.0 * _x_x_13)) <= -3.0) && (((x_14 + (-1.0 * _x_x_13)) <= -10.0) && (((x_13 + (-1.0 * _x_x_13)) <= -19.0) && (((x_12 + (-1.0 * _x_x_13)) <= -17.0) && (((x_11 + (-1.0 * _x_x_13)) <= -4.0) && (((x_10 + (-1.0 * _x_x_13)) <= -7.0) && (((x_9 + (-1.0 * _x_x_13)) <= -20.0) && (((x_7 + (-1.0 * _x_x_13)) <= -6.0) && ((x_8 + (-1.0 * _x_x_13)) <= -11.0)))))))))) && (((x_18 + (-1.0 * _x_x_13)) == -12.0) || (((x_15 + (-1.0 * _x_x_13)) == -3.0) || (((x_14 + (-1.0 * _x_x_13)) == -10.0) || (((x_13 + (-1.0 * _x_x_13)) == -19.0) || (((x_12 + (-1.0 * _x_x_13)) == -17.0) || (((x_11 + (-1.0 * _x_x_13)) == -4.0) || (((x_10 + (-1.0 * _x_x_13)) == -7.0) || (((x_9 + (-1.0 * _x_x_13)) == -20.0) || (((x_7 + (-1.0 * _x_x_13)) == -6.0) || ((x_8 + (-1.0 * _x_x_13)) == -11.0)))))))))))) && ((((x_16 + (-1.0 * _x_x_14)) <= -7.0) && (((x_13 + (-1.0 * _x_x_14)) <= -19.0) && (((x_10 + (-1.0 * _x_x_14)) <= -6.0) && (((x_9 + (-1.0 * _x_x_14)) <= -15.0) && (((x_7 + (-1.0 * _x_x_14)) <= -6.0) && (((x_6 + (-1.0 * _x_x_14)) <= -4.0) && (((x_4 + (-1.0 * _x_x_14)) <= -8.0) && (((x_2 + (-1.0 * _x_x_14)) <= -9.0) && (((x_0 + (-1.0 * _x_x_14)) <= -18.0) && ((x_1 + (-1.0 * _x_x_14)) <= -2.0)))))))))) && (((x_16 + (-1.0 * _x_x_14)) == -7.0) || (((x_13 + (-1.0 * _x_x_14)) == -19.0) || (((x_10 + (-1.0 * _x_x_14)) == -6.0) || (((x_9 + (-1.0 * _x_x_14)) == -15.0) || (((x_7 + (-1.0 * _x_x_14)) == -6.0) || (((x_6 + (-1.0 * _x_x_14)) == -4.0) || (((x_4 + (-1.0 * _x_x_14)) == -8.0) || (((x_2 + (-1.0 * _x_x_14)) == -9.0) || (((x_0 + (-1.0 * _x_x_14)) == -18.0) || ((x_1 + (-1.0 * _x_x_14)) == -2.0)))))))))))) && ((((x_19 + (-1.0 * _x_x_15)) <= -12.0) && (((x_16 + (-1.0 * _x_x_15)) <= -10.0) && (((x_13 + (-1.0 * _x_x_15)) <= -2.0) && (((x_12 + (-1.0 * _x_x_15)) <= -20.0) && (((x_10 + (-1.0 * _x_x_15)) <= -8.0) && (((x_9 + (-1.0 * _x_x_15)) <= -8.0) && (((x_8 + (-1.0 * _x_x_15)) <= -11.0) && (((x_6 + (-1.0 * _x_x_15)) <= -4.0) && (((x_1 + (-1.0 * _x_x_15)) <= -2.0) && ((x_3 + (-1.0 * _x_x_15)) <= -8.0)))))))))) && (((x_19 + (-1.0 * _x_x_15)) == -12.0) || (((x_16 + (-1.0 * _x_x_15)) == -10.0) || (((x_13 + (-1.0 * _x_x_15)) == -2.0) || (((x_12 + (-1.0 * _x_x_15)) == -20.0) || (((x_10 + (-1.0 * _x_x_15)) == -8.0) || (((x_9 + (-1.0 * _x_x_15)) == -8.0) || (((x_8 + (-1.0 * _x_x_15)) == -11.0) || (((x_6 + (-1.0 * _x_x_15)) == -4.0) || (((x_1 + (-1.0 * _x_x_15)) == -2.0) || ((x_3 + (-1.0 * _x_x_15)) == -8.0)))))))))))) && ((((x_17 + (-1.0 * _x_x_16)) <= -11.0) && (((x_15 + (-1.0 * _x_x_16)) <= -9.0) && (((x_13 + (-1.0 * _x_x_16)) <= -10.0) && (((x_11 + (-1.0 * _x_x_16)) <= -9.0) && (((x_8 + (-1.0 * _x_x_16)) <= -1.0) && (((x_6 + (-1.0 * _x_x_16)) <= -6.0) && (((x_5 + (-1.0 * _x_x_16)) <= -20.0) && (((x_3 + (-1.0 * _x_x_16)) <= -19.0) && (((x_0 + (-1.0 * _x_x_16)) <= -18.0) && ((x_2 + (-1.0 * _x_x_16)) <= -14.0)))))))))) && (((x_17 + (-1.0 * _x_x_16)) == -11.0) || (((x_15 + (-1.0 * _x_x_16)) == -9.0) || (((x_13 + (-1.0 * _x_x_16)) == -10.0) || (((x_11 + (-1.0 * _x_x_16)) == -9.0) || (((x_8 + (-1.0 * _x_x_16)) == -1.0) || (((x_6 + (-1.0 * _x_x_16)) == -6.0) || (((x_5 + (-1.0 * _x_x_16)) == -20.0) || (((x_3 + (-1.0 * _x_x_16)) == -19.0) || (((x_0 + (-1.0 * _x_x_16)) == -18.0) || ((x_2 + (-1.0 * _x_x_16)) == -14.0)))))))))))) && ((((x_18 + (-1.0 * _x_x_17)) <= -16.0) && (((x_17 + (-1.0 * _x_x_17)) <= -4.0) && (((x_15 + (-1.0 * _x_x_17)) <= -16.0) && (((x_12 + (-1.0 * _x_x_17)) <= -17.0) && (((x_9 + (-1.0 * _x_x_17)) <= -14.0) && (((x_8 + (-1.0 * _x_x_17)) <= -11.0) && (((x_7 + (-1.0 * _x_x_17)) <= -1.0) && (((x_5 + (-1.0 * _x_x_17)) <= -9.0) && (((x_0 + (-1.0 * _x_x_17)) <= -7.0) && ((x_4 + (-1.0 * _x_x_17)) <= -12.0)))))))))) && (((x_18 + (-1.0 * _x_x_17)) == -16.0) || (((x_17 + (-1.0 * _x_x_17)) == -4.0) || (((x_15 + (-1.0 * _x_x_17)) == -16.0) || (((x_12 + (-1.0 * _x_x_17)) == -17.0) || (((x_9 + (-1.0 * _x_x_17)) == -14.0) || (((x_8 + (-1.0 * _x_x_17)) == -11.0) || (((x_7 + (-1.0 * _x_x_17)) == -1.0) || (((x_5 + (-1.0 * _x_x_17)) == -9.0) || (((x_0 + (-1.0 * _x_x_17)) == -7.0) || ((x_4 + (-1.0 * _x_x_17)) == -12.0)))))))))))) && ((((x_19 + (-1.0 * _x_x_18)) <= -12.0) && (((x_18 + (-1.0 * _x_x_18)) <= -14.0) && (((x_17 + (-1.0 * _x_x_18)) <= -5.0) && (((x_16 + (-1.0 * _x_x_18)) <= -11.0) && (((x_15 + (-1.0 * _x_x_18)) <= -8.0) && (((x_14 + (-1.0 * _x_x_18)) <= -20.0) && (((x_9 + (-1.0 * _x_x_18)) <= -9.0) && (((x_7 + (-1.0 * _x_x_18)) <= -13.0) && (((x_2 + (-1.0 * _x_x_18)) <= -5.0) && ((x_3 + (-1.0 * _x_x_18)) <= -5.0)))))))))) && (((x_19 + (-1.0 * _x_x_18)) == -12.0) || (((x_18 + (-1.0 * _x_x_18)) == -14.0) || (((x_17 + (-1.0 * _x_x_18)) == -5.0) || (((x_16 + (-1.0 * _x_x_18)) == -11.0) || (((x_15 + (-1.0 * _x_x_18)) == -8.0) || (((x_14 + (-1.0 * _x_x_18)) == -20.0) || (((x_9 + (-1.0 * _x_x_18)) == -9.0) || (((x_7 + (-1.0 * _x_x_18)) == -13.0) || (((x_2 + (-1.0 * _x_x_18)) == -5.0) || ((x_3 + (-1.0 * _x_x_18)) == -5.0)))))))))))) && ((((x_17 + (-1.0 * _x_x_19)) <= -11.0) && (((x_16 + (-1.0 * _x_x_19)) <= -10.0) && (((x_14 + (-1.0 * _x_x_19)) <= -14.0) && (((x_13 + (-1.0 * _x_x_19)) <= -9.0) && (((x_11 + (-1.0 * _x_x_19)) <= -18.0) && (((x_9 + (-1.0 * _x_x_19)) <= -2.0) && (((x_8 + (-1.0 * _x_x_19)) <= -19.0) && (((x_6 + (-1.0 * _x_x_19)) <= -15.0) && (((x_3 + (-1.0 * _x_x_19)) <= -9.0) && ((x_5 + (-1.0 * _x_x_19)) <= -9.0)))))))))) && (((x_17 + (-1.0 * _x_x_19)) == -11.0) || (((x_16 + (-1.0 * _x_x_19)) == -10.0) || (((x_14 + (-1.0 * _x_x_19)) == -14.0) || (((x_13 + (-1.0 * _x_x_19)) == -9.0) || (((x_11 + (-1.0 * _x_x_19)) == -18.0) || (((x_9 + (-1.0 * _x_x_19)) == -2.0) || (((x_8 + (-1.0 * _x_x_19)) == -19.0) || (((x_6 + (-1.0 * _x_x_19)) == -15.0) || (((x_3 + (-1.0 * _x_x_19)) == -9.0) || ((x_5 + (-1.0 * _x_x_19)) == -9.0)))))))))))) && (((((_EL_U_1275 == ((_x__EL_U_1275 && (_x__EL_U_1274 || ((_x_x_17 + (-1.0 * _x_x_18)) <= 1.0))) || ( !(_x__EL_U_1272 || ( !(-7.0 <= (_x_x_0 + (-1.0 * _x_x_13)))))))) && ((_EL_U_1272 == (_x__EL_U_1272 || ( !(-7.0 <= (_x_x_0 + (-1.0 * _x_x_13)))))) && (_EL_U_1274 == (_x__EL_U_1274 || ((_x_x_17 + (-1.0 * _x_x_18)) <= 1.0))))) && (_x__J1293 == (( !((_J1293 && _J1300) && _J1308)) && (((_J1293 && _J1300) && _J1308) || ((( !(-7.0 <= (x_0 + (-1.0 * x_13)))) || ( !(( !(-7.0 <= (x_0 + (-1.0 * x_13)))) || _EL_U_1272))) || _J1293))))) && (_x__J1300 == (( !((_J1293 && _J1300) && _J1308)) && (((_J1293 && _J1300) && _J1308) || ((((x_17 + (-1.0 * x_18)) <= 1.0) || ( !(((x_17 + (-1.0 * x_18)) <= 1.0) || _EL_U_1274))) || _J1300))))) && (_x__J1308 == (( !((_J1293 && _J1300) && _J1308)) && (((_J1293 && _J1300) && _J1308) || ((( !(( !(-7.0 <= (x_0 + (-1.0 * x_13)))) || _EL_U_1272)) || ( !(( !(( !(-7.0 <= (x_0 + (-1.0 * x_13)))) || _EL_U_1272)) || (_EL_U_1275 && (((x_17 + (-1.0 * x_18)) <= 1.0) || _EL_U_1274))))) || _J1308)))))); _J1308 = _x__J1308; _J1300 = _x__J1300; _J1293 = _x__J1293; _EL_U_1274 = _x__EL_U_1274; x_18 = _x_x_18; x_15 = _x_x_15; x_17 = _x_x_17; _EL_U_1275 = _x__EL_U_1275; _EL_U_1272 = _x__EL_U_1272; x_13 = _x_x_13; x_0 = _x_x_0; x_19 = _x_x_19; x_1 = _x_x_1; x_5 = _x_x_5; x_3 = _x_x_3; x_6 = _x_x_6; x_10 = _x_x_10; x_4 = _x_x_4; x_8 = _x_x_8; x_9 = _x_x_9; x_11 = _x_x_11; x_12 = _x_x_12; x_14 = _x_x_14; x_16 = _x_x_16; x_2 = _x_x_2; x_7 = _x_x_7; } }
the_stack_data/161081101.c
#include<stdio.h> int main() { int c= 0; char ch,s[50]; printf("Input a string\n"); scanf("%s",&s); while (s[c]!='\0') { ch =s[c]; if(ch>='A'&&ch<='Z') s[c]=s[c]+32; else if(ch>='a'&&ch<='z') s[c]=s[c]-32; c++; } printf("%s\n",s); return 0; }
the_stack_data/220454362.c
#include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define PREV_INUSE 0x1 #define IS_MMAPPED 0x2 typedef size_t INTERNAL_SIZE_T; struct malloc_chunk { INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */ INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */ struct malloc_chunk* fd; /* double links -- used only if free. */ struct malloc_chunk* bk; /* Only used for large blocks: pointer to next larger size. */ struct malloc_chunk* fd_nextsize; /* double links -- used only if free. */ struct malloc_chunk* bk_nextsize; }; typedef struct malloc_chunk* mchunkptr; int main(int argc, const char* argv[]) { void *mem = malloc(0x100); mchunkptr chunk = (mchunkptr)((char*)mem - offsetof(struct malloc_chunk, fd)); printf("allocated victim chunk with requested size 0x100, " \ "victim->size == 0x%zx\n", chunk->size); malloc(0x100); printf("allocated another chunk to prevent victim from being " \ "coalesced into top\n"); printf("freeing victim chunk\n"); free(mem); printf("emulating corruption of the IS_MMAPPED bit of victim->size\n"); chunk->size = chunk->size | IS_MMAPPED; printf("making a calloc request for an exact size match\n"); size_t *calloced = calloc(0x100, 1); printf("the first 2 qwords of the returned region:\n0x%zx 0x%zx\n", calloced[0], calloced[1]); return 0; }
the_stack_data/156393749.c
// rows2.c -- using dependent nested loops #include <stdio.h> int main(void) { const int ROWS = 6; const int CHARS = 6; int row; char ch; for (row = 0; row < ROWS; row++) { for (ch = ('A' + row); ch < ('A' + CHARS); ch++) printf("%c", ch); printf("\n"); } return 0; }
the_stack_data/68889047.c
#include<stdio.h> int main(){ int grid[][20]={8, 2 ,22, 97, 38, 15, 0, 40, 0 ,75 ,4, 5, 7, 78, 52, 12, 50, 77, 91, 8, 49 ,49 ,99 ,40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48 ,4, 56, 62 ,0, 81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65, 52, 70, 95, 23, 4, 60, 11, 42, 69, 24 ,68, 56, 1, 32, 56, 71, 37, 2, 36, 91, 22 ,31 ,16 ,71 ,51 ,67 ,63 ,89 ,41 ,92 ,36 ,54 ,22 ,40 ,40 ,28 ,66 ,33 ,13 ,80, 24, 47, 32, 60, 99 ,3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20,35, 17, 12, 50, 32 ,98 ,81 ,28 ,64 ,23 ,67 ,10 ,26 ,38 ,40 ,67 ,59 ,54 ,70 ,66 ,18 ,38 ,64 ,70, 67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21, 24 ,55 ,58 ,5 ,66 ,73 ,99 ,26 ,97 ,17 ,78 ,78 ,96 ,83 ,14 ,88 ,34 ,89, 63, 72, 21, 36, 23 ,9, 75, 0, 76, 44, 20 ,45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95, 78 ,17 ,53 ,28 ,22 ,75 ,31 ,67 ,15 ,94 ,3 ,80 ,4 ,62 ,16 ,14 ,9 ,53 ,56 ,92, 16, 39, 5, 42 ,96 ,35 ,31 ,47 ,55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57, 86 ,56 ,0 ,48 ,35 ,71 ,89 ,7 ,5 ,44 ,44 ,37 ,44 ,60 ,21 ,58, 51, 54, 17 ,58, 19, 80, 81, 68 ,5, 94, 47 ,69 ,28 ,73 ,92 ,13, 86, 52 ,17 ,77, 4 ,89 ,55, 40, 4 ,52 ,8 ,83 ,97 ,35 ,99, 16 ,7 ,97 ,57 ,32 ,16 ,26 ,26 ,79 ,33 ,27 ,98, 66, 88 ,36 ,68, 87, 57, 62, 20, 72 ,3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53 ,69, 4, 42 ,16 ,73 ,38 ,25 ,39 ,11 ,24 ,94 ,72 ,18, 8 ,46 ,29, 32 ,40, 62, 76, 36, 20, 69 ,36, 41, 72, 30 ,23 ,88 ,34 ,62 ,99 ,69 ,82 ,67, 59 ,85, 74, 4 ,36 ,16, 20 ,73 ,35 ,29 ,78 ,31 ,90 ,1 ,74 ,31 ,49 ,71 ,48 ,86 ,81 ,16 ,23 ,57, 5, 54, 1, 70, 54 ,71 ,83 ,51 ,54, 69, 16, 92 ,33 ,48, 61, 43 ,52, 1, 89, 19, 67, 48 }; long int product=1,max_product=1; int i,j; //UP for(i=3;i<20;++i){ for(j=0;j<20;++j){ product=grid[i][j]*grid[i-1][j]*grid[i-2][j]*grid[i-3][j]; if(max_product<product){ max_product=product; } } } //LEFT for(j=3;j<20;++j){ for(i=0;i<20;++i){ product=grid[i][j]*grid[i][j-1]*grid[i][j-2]*grid[i][j-3]; if(max_product<product){ max_product=product; } } } //DIAGONAL DOWN RIGHT for(i=0;i<17;++i){ for(j=0;j<17;++j){ product=grid[i][j]*grid[i+1][j+1]*grid[i+2][j+2]*grid[i+3][j+3]; if(max_product<product){ max_product=product; } } } //DIAGONAL UP RIGHT for(i=3;i<20;++i){ for(j=0;j<17;++j){ product=grid[i][j]*grid[i-1][j+1]*grid[i-2][j+2]*grid[i-3][j+3]; if(max_product<product){ max_product=product; } } } printf("%ld",max_product); return 0; }
the_stack_data/72013706.c
#include <assert.h> union U_ok { int x; int y; } u_ok = {.x = 1, .y = 2}; #ifndef _MSC_VER union U { int x; int y; } u = {1, 2}; int main() { assert(u_ok.y == 2); // the excess initializer (2) is ignored assert(u.x == 1); } #else int main() { assert(u_ok.y == 2); } #endif
the_stack_data/1185977.c
/* LibTomCrypt, modular cryptographic library -- Tom St Denis * * LibTomCrypt is a library that provides various cryptographic * algorithms in a highly modular and flexible manner. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, [email protected], http://libtom.org */ /** @file twofish_tab.c Twofish tables, Tom St Denis */ #ifdef LTC_TWOFISH_TABLES /* pre generated 8x8 tables from the four 4x4s */ static const unsigned char SBOX[2][256] = { { 0xa9, 0x67, 0xb3, 0xe8, 0x04, 0xfd, 0xa3, 0x76, 0x9a, 0x92, 0x80, 0x78, 0xe4, 0xdd, 0xd1, 0x38, 0x0d, 0xc6, 0x35, 0x98, 0x18, 0xf7, 0xec, 0x6c, 0x43, 0x75, 0x37, 0x26, 0xfa, 0x13, 0x94, 0x48, 0xf2, 0xd0, 0x8b, 0x30, 0x84, 0x54, 0xdf, 0x23, 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0x49, 0x81, 0x88, 0xee, 0x21, 0xc4, 0x1a, 0xeb, 0xd9, 0xc5, 0x39, 0x99, 0xcd, 0xad, 0x31, 0x8b, 0x01, 0x18, 0x23, 0xdd, 0x1f, 0x4e, 0x2d, 0xf9, 0x48, 0x4f, 0xf2, 0x65, 0x8e, 0x78, 0x5c, 0x58, 0x19, 0x8d, 0xe5, 0x98, 0x57, 0x67, 0x7f, 0x05, 0x64, 0xaf, 0x63, 0xb6, 0xfe, 0xf5, 0xb7, 0x3c, 0xa5, 0xce, 0xe9, 0x68, 0x44, 0xe0, 0x4d, 0x43, 0x69, 0x29, 0x2e, 0xac, 0x15, 0x59, 0xa8, 0x0a, 0x9e, 0x6e, 0x47, 0xdf, 0x34, 0x35, 0x6a, 0xcf, 0xdc, 0x22, 0xc9, 0xc0, 0x9b, 0x89, 0xd4, 0xed, 0xab, 0x12, 0xa2, 0x0d, 0x52, 0xbb, 0x02, 0x2f, 0xa9, 0xd7, 0x61, 0x1e, 0xb4, 0x50, 0x04, 0xf6, 0xc2, 0x16, 0x25, 0x86, 0x56, 0x55, 0x09, 0xbe, 0x91} }; /* the 4x4 MDS in a nicer format */ static const ulong32 mds_tab[4][256] = { { 0x00000000UL, 0xefef5b01UL, 0xb7b7b602UL, 0x5858ed03UL, 0x07070504UL, 0xe8e85e05UL, 0xb0b0b306UL, 0x5f5fe807UL, 0x0e0e0a08UL, 0xe1e15109UL, 0xb9b9bc0aUL, 0x5656e70bUL, 0x09090f0cUL, 0xe6e6540dUL, 0xbebeb90eUL, 0x5151e20fUL, 0x1c1c1410UL, 0xf3f34f11UL, 0xababa212UL, 0x4444f913UL, 0x1b1b1114UL, 0xf4f44a15UL, 0xacaca716UL, 0x4343fc17UL, 0x12121e18UL, 0xfdfd4519UL, 0xa5a5a81aUL, 0x4a4af31bUL, 0x15151b1cUL, 0xfafa401dUL, 0xa2a2ad1eUL, 0x4d4df61fUL, 0x38382820UL, 0xd7d77321UL, 0x8f8f9e22UL, 0x6060c523UL, 0x3f3f2d24UL, 0xd0d07625UL, 0x88889b26UL, 0x6767c027UL, 0x36362228UL, 0xd9d97929UL, 0x8181942aUL, 0x6e6ecf2bUL, 0x3131272cUL, 0xdede7c2dUL, 0x8686912eUL, 0x6969ca2fUL, 0x24243c30UL, 0xcbcb6731UL, 0x93938a32UL, 0x7c7cd133UL, 0x23233934UL, 0xcccc6235UL, 0x94948f36UL, 0x7b7bd437UL, 0x2a2a3638UL, 0xc5c56d39UL, 0x9d9d803aUL, 0x7272db3bUL, 0x2d2d333cUL, 0xc2c2683dUL, 0x9a9a853eUL, 0x7575de3fUL, 0x70705040UL, 0x9f9f0b41UL, 0xc7c7e642UL, 0x2828bd43UL, 0x77775544UL, 0x98980e45UL, 0xc0c0e346UL, 0x2f2fb847UL, 0x7e7e5a48UL, 0x91910149UL, 0xc9c9ec4aUL, 0x2626b74bUL, 0x79795f4cUL, 0x9696044dUL, 0xcecee94eUL, 0x2121b24fUL, 0x6c6c4450UL, 0x83831f51UL, 0xdbdbf252UL, 0x3434a953UL, 0x6b6b4154UL, 0x84841a55UL, 0xdcdcf756UL, 0x3333ac57UL, 0x62624e58UL, 0x8d8d1559UL, 0xd5d5f85aUL, 0x3a3aa35bUL, 0x65654b5cUL, 0x8a8a105dUL, 0xd2d2fd5eUL, 0x3d3da65fUL, 0x48487860UL, 0xa7a72361UL, 0xffffce62UL, 0x10109563UL, 0x4f4f7d64UL, 0xa0a02665UL, 0xf8f8cb66UL, 0x17179067UL, 0x46467268UL, 0xa9a92969UL, 0xf1f1c46aUL, 0x1e1e9f6bUL, 0x4141776cUL, 0xaeae2c6dUL, 0xf6f6c16eUL, 0x19199a6fUL, 0x54546c70UL, 0xbbbb3771UL, 0xe3e3da72UL, 0x0c0c8173UL, 0x53536974UL, 0xbcbc3275UL, 0xe4e4df76UL, 0x0b0b8477UL, 0x5a5a6678UL, 0xb5b53d79UL, 0xededd07aUL, 0x02028b7bUL, 0x5d5d637cUL, 0xb2b2387dUL, 0xeaead57eUL, 0x05058e7fUL, 0xe0e0a080UL, 0x0f0ffb81UL, 0x57571682UL, 0xb8b84d83UL, 0xe7e7a584UL, 0x0808fe85UL, 0x50501386UL, 0xbfbf4887UL, 0xeeeeaa88UL, 0x0101f189UL, 0x59591c8aUL, 0xb6b6478bUL, 0xe9e9af8cUL, 0x0606f48dUL, 0x5e5e198eUL, 0xb1b1428fUL, 0xfcfcb490UL, 0x1313ef91UL, 0x4b4b0292UL, 0xa4a45993UL, 0xfbfbb194UL, 0x1414ea95UL, 0x4c4c0796UL, 0xa3a35c97UL, 0xf2f2be98UL, 0x1d1de599UL, 0x4545089aUL, 0xaaaa539bUL, 0xf5f5bb9cUL, 0x1a1ae09dUL, 0x42420d9eUL, 0xadad569fUL, 0xd8d888a0UL, 0x3737d3a1UL, 0x6f6f3ea2UL, 0x808065a3UL, 0xdfdf8da4UL, 0x3030d6a5UL, 0x68683ba6UL, 0x878760a7UL, 0xd6d682a8UL, 0x3939d9a9UL, 0x616134aaUL, 0x8e8e6fabUL, 0xd1d187acUL, 0x3e3edcadUL, 0x666631aeUL, 0x89896aafUL, 0xc4c49cb0UL, 0x2b2bc7b1UL, 0x73732ab2UL, 0x9c9c71b3UL, 0xc3c399b4UL, 0x2c2cc2b5UL, 0x74742fb6UL, 0x9b9b74b7UL, 0xcaca96b8UL, 0x2525cdb9UL, 0x7d7d20baUL, 0x92927bbbUL, 0xcdcd93bcUL, 0x2222c8bdUL, 0x7a7a25beUL, 0x95957ebfUL, 0x9090f0c0UL, 0x7f7fabc1UL, 0x272746c2UL, 0xc8c81dc3UL, 0x9797f5c4UL, 0x7878aec5UL, 0x202043c6UL, 0xcfcf18c7UL, 0x9e9efac8UL, 0x7171a1c9UL, 0x29294ccaUL, 0xc6c617cbUL, 0x9999ffccUL, 0x7676a4cdUL, 0x2e2e49ceUL, 0xc1c112cfUL, 0x8c8ce4d0UL, 0x6363bfd1UL, 0x3b3b52d2UL, 0xd4d409d3UL, 0x8b8be1d4UL, 0x6464bad5UL, 0x3c3c57d6UL, 0xd3d30cd7UL, 0x8282eed8UL, 0x6d6db5d9UL, 0x353558daUL, 0xdada03dbUL, 0x8585ebdcUL, 0x6a6ab0ddUL, 0x32325ddeUL, 0xdddd06dfUL, 0xa8a8d8e0UL, 0x474783e1UL, 0x1f1f6ee2UL, 0xf0f035e3UL, 0xafafdde4UL, 0x404086e5UL, 0x18186be6UL, 0xf7f730e7UL, 0xa6a6d2e8UL, 0x494989e9UL, 0x111164eaUL, 0xfefe3febUL, 0xa1a1d7ecUL, 0x4e4e8cedUL, 0x161661eeUL, 0xf9f93aefUL, 0xb4b4ccf0UL, 0x5b5b97f1UL, 0x03037af2UL, 0xecec21f3UL, 0xb3b3c9f4UL, 0x5c5c92f5UL, 0x04047ff6UL, 0xebeb24f7UL, 0xbabac6f8UL, 0x55559df9UL, 0x0d0d70faUL, 0xe2e22bfbUL, 0xbdbdc3fcUL, 0x525298fdUL, 0x0a0a75feUL, 0xe5e52effUL }, { 0x00000000UL, 0x015befefUL, 0x02b6b7b7UL, 0x03ed5858UL, 0x04050707UL, 0x055ee8e8UL, 0x06b3b0b0UL, 0x07e85f5fUL, 0x080a0e0eUL, 0x0951e1e1UL, 0x0abcb9b9UL, 0x0be75656UL, 0x0c0f0909UL, 0x0d54e6e6UL, 0x0eb9bebeUL, 0x0fe25151UL, 0x10141c1cUL, 0x114ff3f3UL, 0x12a2ababUL, 0x13f94444UL, 0x14111b1bUL, 0x154af4f4UL, 0x16a7acacUL, 0x17fc4343UL, 0x181e1212UL, 0x1945fdfdUL, 0x1aa8a5a5UL, 0x1bf34a4aUL, 0x1c1b1515UL, 0x1d40fafaUL, 0x1eada2a2UL, 0x1ff64d4dUL, 0x20283838UL, 0x2173d7d7UL, 0x229e8f8fUL, 0x23c56060UL, 0x242d3f3fUL, 0x2576d0d0UL, 0x269b8888UL, 0x27c06767UL, 0x28223636UL, 0x2979d9d9UL, 0x2a948181UL, 0x2bcf6e6eUL, 0x2c273131UL, 0x2d7cdedeUL, 0x2e918686UL, 0x2fca6969UL, 0x303c2424UL, 0x3167cbcbUL, 0x328a9393UL, 0x33d17c7cUL, 0x34392323UL, 0x3562ccccUL, 0x368f9494UL, 0x37d47b7bUL, 0x38362a2aUL, 0x396dc5c5UL, 0x3a809d9dUL, 0x3bdb7272UL, 0x3c332d2dUL, 0x3d68c2c2UL, 0x3e859a9aUL, 0x3fde7575UL, 0x40507070UL, 0x410b9f9fUL, 0x42e6c7c7UL, 0x43bd2828UL, 0x44557777UL, 0x450e9898UL, 0x46e3c0c0UL, 0x47b82f2fUL, 0x485a7e7eUL, 0x49019191UL, 0x4aecc9c9UL, 0x4bb72626UL, 0x4c5f7979UL, 0x4d049696UL, 0x4ee9ceceUL, 0x4fb22121UL, 0x50446c6cUL, 0x511f8383UL, 0x52f2dbdbUL, 0x53a93434UL, 0x54416b6bUL, 0x551a8484UL, 0x56f7dcdcUL, 0x57ac3333UL, 0x584e6262UL, 0x59158d8dUL, 0x5af8d5d5UL, 0x5ba33a3aUL, 0x5c4b6565UL, 0x5d108a8aUL, 0x5efdd2d2UL, 0x5fa63d3dUL, 0x60784848UL, 0x6123a7a7UL, 0x62ceffffUL, 0x63951010UL, 0x647d4f4fUL, 0x6526a0a0UL, 0x66cbf8f8UL, 0x67901717UL, 0x68724646UL, 0x6929a9a9UL, 0x6ac4f1f1UL, 0x6b9f1e1eUL, 0x6c774141UL, 0x6d2caeaeUL, 0x6ec1f6f6UL, 0x6f9a1919UL, 0x706c5454UL, 0x7137bbbbUL, 0x72dae3e3UL, 0x73810c0cUL, 0x74695353UL, 0x7532bcbcUL, 0x76dfe4e4UL, 0x77840b0bUL, 0x78665a5aUL, 0x793db5b5UL, 0x7ad0ededUL, 0x7b8b0202UL, 0x7c635d5dUL, 0x7d38b2b2UL, 0x7ed5eaeaUL, 0x7f8e0505UL, 0x80a0e0e0UL, 0x81fb0f0fUL, 0x82165757UL, 0x834db8b8UL, 0x84a5e7e7UL, 0x85fe0808UL, 0x86135050UL, 0x8748bfbfUL, 0x88aaeeeeUL, 0x89f10101UL, 0x8a1c5959UL, 0x8b47b6b6UL, 0x8cafe9e9UL, 0x8df40606UL, 0x8e195e5eUL, 0x8f42b1b1UL, 0x90b4fcfcUL, 0x91ef1313UL, 0x92024b4bUL, 0x9359a4a4UL, 0x94b1fbfbUL, 0x95ea1414UL, 0x96074c4cUL, 0x975ca3a3UL, 0x98bef2f2UL, 0x99e51d1dUL, 0x9a084545UL, 0x9b53aaaaUL, 0x9cbbf5f5UL, 0x9de01a1aUL, 0x9e0d4242UL, 0x9f56adadUL, 0xa088d8d8UL, 0xa1d33737UL, 0xa23e6f6fUL, 0xa3658080UL, 0xa48ddfdfUL, 0xa5d63030UL, 0xa63b6868UL, 0xa7608787UL, 0xa882d6d6UL, 0xa9d93939UL, 0xaa346161UL, 0xab6f8e8eUL, 0xac87d1d1UL, 0xaddc3e3eUL, 0xae316666UL, 0xaf6a8989UL, 0xb09cc4c4UL, 0xb1c72b2bUL, 0xb22a7373UL, 0xb3719c9cUL, 0xb499c3c3UL, 0xb5c22c2cUL, 0xb62f7474UL, 0xb7749b9bUL, 0xb896cacaUL, 0xb9cd2525UL, 0xba207d7dUL, 0xbb7b9292UL, 0xbc93cdcdUL, 0xbdc82222UL, 0xbe257a7aUL, 0xbf7e9595UL, 0xc0f09090UL, 0xc1ab7f7fUL, 0xc2462727UL, 0xc31dc8c8UL, 0xc4f59797UL, 0xc5ae7878UL, 0xc6432020UL, 0xc718cfcfUL, 0xc8fa9e9eUL, 0xc9a17171UL, 0xca4c2929UL, 0xcb17c6c6UL, 0xccff9999UL, 0xcda47676UL, 0xce492e2eUL, 0xcf12c1c1UL, 0xd0e48c8cUL, 0xd1bf6363UL, 0xd2523b3bUL, 0xd309d4d4UL, 0xd4e18b8bUL, 0xd5ba6464UL, 0xd6573c3cUL, 0xd70cd3d3UL, 0xd8ee8282UL, 0xd9b56d6dUL, 0xda583535UL, 0xdb03dadaUL, 0xdceb8585UL, 0xddb06a6aUL, 0xde5d3232UL, 0xdf06ddddUL, 0xe0d8a8a8UL, 0xe1834747UL, 0xe26e1f1fUL, 0xe335f0f0UL, 0xe4ddafafUL, 0xe5864040UL, 0xe66b1818UL, 0xe730f7f7UL, 0xe8d2a6a6UL, 0xe9894949UL, 0xea641111UL, 0xeb3ffefeUL, 0xecd7a1a1UL, 0xed8c4e4eUL, 0xee611616UL, 0xef3af9f9UL, 0xf0ccb4b4UL, 0xf1975b5bUL, 0xf27a0303UL, 0xf321ececUL, 0xf4c9b3b3UL, 0xf5925c5cUL, 0xf67f0404UL, 0xf724ebebUL, 0xf8c6babaUL, 0xf99d5555UL, 0xfa700d0dUL, 0xfb2be2e2UL, 0xfcc3bdbdUL, 0xfd985252UL, 0xfe750a0aUL, 0xff2ee5e5UL }, { 0x00000000UL, 0xef01ef5bUL, 0xb702b7b6UL, 0x580358edUL, 0x07040705UL, 0xe805e85eUL, 0xb006b0b3UL, 0x5f075fe8UL, 0x0e080e0aUL, 0xe109e151UL, 0xb90ab9bcUL, 0x560b56e7UL, 0x090c090fUL, 0xe60de654UL, 0xbe0ebeb9UL, 0x510f51e2UL, 0x1c101c14UL, 0xf311f34fUL, 0xab12aba2UL, 0x441344f9UL, 0x1b141b11UL, 0xf415f44aUL, 0xac16aca7UL, 0x431743fcUL, 0x1218121eUL, 0xfd19fd45UL, 0xa51aa5a8UL, 0x4a1b4af3UL, 0x151c151bUL, 0xfa1dfa40UL, 0xa21ea2adUL, 0x4d1f4df6UL, 0x38203828UL, 0xd721d773UL, 0x8f228f9eUL, 0x602360c5UL, 0x3f243f2dUL, 0xd025d076UL, 0x8826889bUL, 0x672767c0UL, 0x36283622UL, 0xd929d979UL, 0x812a8194UL, 0x6e2b6ecfUL, 0x312c3127UL, 0xde2dde7cUL, 0x862e8691UL, 0x692f69caUL, 0x2430243cUL, 0xcb31cb67UL, 0x9332938aUL, 0x7c337cd1UL, 0x23342339UL, 0xcc35cc62UL, 0x9436948fUL, 0x7b377bd4UL, 0x2a382a36UL, 0xc539c56dUL, 0x9d3a9d80UL, 0x723b72dbUL, 0x2d3c2d33UL, 0xc23dc268UL, 0x9a3e9a85UL, 0x753f75deUL, 0x70407050UL, 0x9f419f0bUL, 0xc742c7e6UL, 0x284328bdUL, 0x77447755UL, 0x9845980eUL, 0xc046c0e3UL, 0x2f472fb8UL, 0x7e487e5aUL, 0x91499101UL, 0xc94ac9ecUL, 0x264b26b7UL, 0x794c795fUL, 0x964d9604UL, 0xce4ecee9UL, 0x214f21b2UL, 0x6c506c44UL, 0x8351831fUL, 0xdb52dbf2UL, 0x345334a9UL, 0x6b546b41UL, 0x8455841aUL, 0xdc56dcf7UL, 0x335733acUL, 0x6258624eUL, 0x8d598d15UL, 0xd55ad5f8UL, 0x3a5b3aa3UL, 0x655c654bUL, 0x8a5d8a10UL, 0xd25ed2fdUL, 0x3d5f3da6UL, 0x48604878UL, 0xa761a723UL, 0xff62ffceUL, 0x10631095UL, 0x4f644f7dUL, 0xa065a026UL, 0xf866f8cbUL, 0x17671790UL, 0x46684672UL, 0xa969a929UL, 0xf16af1c4UL, 0x1e6b1e9fUL, 0x416c4177UL, 0xae6dae2cUL, 0xf66ef6c1UL, 0x196f199aUL, 0x5470546cUL, 0xbb71bb37UL, 0xe372e3daUL, 0x0c730c81UL, 0x53745369UL, 0xbc75bc32UL, 0xe476e4dfUL, 0x0b770b84UL, 0x5a785a66UL, 0xb579b53dUL, 0xed7aedd0UL, 0x027b028bUL, 0x5d7c5d63UL, 0xb27db238UL, 0xea7eead5UL, 0x057f058eUL, 0xe080e0a0UL, 0x0f810ffbUL, 0x57825716UL, 0xb883b84dUL, 0xe784e7a5UL, 0x088508feUL, 0x50865013UL, 0xbf87bf48UL, 0xee88eeaaUL, 0x018901f1UL, 0x598a591cUL, 0xb68bb647UL, 0xe98ce9afUL, 0x068d06f4UL, 0x5e8e5e19UL, 0xb18fb142UL, 0xfc90fcb4UL, 0x139113efUL, 0x4b924b02UL, 0xa493a459UL, 0xfb94fbb1UL, 0x149514eaUL, 0x4c964c07UL, 0xa397a35cUL, 0xf298f2beUL, 0x1d991de5UL, 0x459a4508UL, 0xaa9baa53UL, 0xf59cf5bbUL, 0x1a9d1ae0UL, 0x429e420dUL, 0xad9fad56UL, 0xd8a0d888UL, 0x37a137d3UL, 0x6fa26f3eUL, 0x80a38065UL, 0xdfa4df8dUL, 0x30a530d6UL, 0x68a6683bUL, 0x87a78760UL, 0xd6a8d682UL, 0x39a939d9UL, 0x61aa6134UL, 0x8eab8e6fUL, 0xd1acd187UL, 0x3ead3edcUL, 0x66ae6631UL, 0x89af896aUL, 0xc4b0c49cUL, 0x2bb12bc7UL, 0x73b2732aUL, 0x9cb39c71UL, 0xc3b4c399UL, 0x2cb52cc2UL, 0x74b6742fUL, 0x9bb79b74UL, 0xcab8ca96UL, 0x25b925cdUL, 0x7dba7d20UL, 0x92bb927bUL, 0xcdbccd93UL, 0x22bd22c8UL, 0x7abe7a25UL, 0x95bf957eUL, 0x90c090f0UL, 0x7fc17fabUL, 0x27c22746UL, 0xc8c3c81dUL, 0x97c497f5UL, 0x78c578aeUL, 0x20c62043UL, 0xcfc7cf18UL, 0x9ec89efaUL, 0x71c971a1UL, 0x29ca294cUL, 0xc6cbc617UL, 0x99cc99ffUL, 0x76cd76a4UL, 0x2ece2e49UL, 0xc1cfc112UL, 0x8cd08ce4UL, 0x63d163bfUL, 0x3bd23b52UL, 0xd4d3d409UL, 0x8bd48be1UL, 0x64d564baUL, 0x3cd63c57UL, 0xd3d7d30cUL, 0x82d882eeUL, 0x6dd96db5UL, 0x35da3558UL, 0xdadbda03UL, 0x85dc85ebUL, 0x6add6ab0UL, 0x32de325dUL, 0xdddfdd06UL, 0xa8e0a8d8UL, 0x47e14783UL, 0x1fe21f6eUL, 0xf0e3f035UL, 0xafe4afddUL, 0x40e54086UL, 0x18e6186bUL, 0xf7e7f730UL, 0xa6e8a6d2UL, 0x49e94989UL, 0x11ea1164UL, 0xfeebfe3fUL, 0xa1eca1d7UL, 0x4eed4e8cUL, 0x16ee1661UL, 0xf9eff93aUL, 0xb4f0b4ccUL, 0x5bf15b97UL, 0x03f2037aUL, 0xecf3ec21UL, 0xb3f4b3c9UL, 0x5cf55c92UL, 0x04f6047fUL, 0xebf7eb24UL, 0xbaf8bac6UL, 0x55f9559dUL, 0x0dfa0d70UL, 0xe2fbe22bUL, 0xbdfcbdc3UL, 0x52fd5298UL, 0x0afe0a75UL, 0xe5ffe52eUL }, { 0x00000000UL, 0x5bef015bUL, 0xb6b702b6UL, 0xed5803edUL, 0x05070405UL, 0x5ee8055eUL, 0xb3b006b3UL, 0xe85f07e8UL, 0x0a0e080aUL, 0x51e10951UL, 0xbcb90abcUL, 0xe7560be7UL, 0x0f090c0fUL, 0x54e60d54UL, 0xb9be0eb9UL, 0xe2510fe2UL, 0x141c1014UL, 0x4ff3114fUL, 0xa2ab12a2UL, 0xf94413f9UL, 0x111b1411UL, 0x4af4154aUL, 0xa7ac16a7UL, 0xfc4317fcUL, 0x1e12181eUL, 0x45fd1945UL, 0xa8a51aa8UL, 0xf34a1bf3UL, 0x1b151c1bUL, 0x40fa1d40UL, 0xada21eadUL, 0xf64d1ff6UL, 0x28382028UL, 0x73d72173UL, 0x9e8f229eUL, 0xc56023c5UL, 0x2d3f242dUL, 0x76d02576UL, 0x9b88269bUL, 0xc06727c0UL, 0x22362822UL, 0x79d92979UL, 0x94812a94UL, 0xcf6e2bcfUL, 0x27312c27UL, 0x7cde2d7cUL, 0x91862e91UL, 0xca692fcaUL, 0x3c24303cUL, 0x67cb3167UL, 0x8a93328aUL, 0xd17c33d1UL, 0x39233439UL, 0x62cc3562UL, 0x8f94368fUL, 0xd47b37d4UL, 0x362a3836UL, 0x6dc5396dUL, 0x809d3a80UL, 0xdb723bdbUL, 0x332d3c33UL, 0x68c23d68UL, 0x859a3e85UL, 0xde753fdeUL, 0x50704050UL, 0x0b9f410bUL, 0xe6c742e6UL, 0xbd2843bdUL, 0x55774455UL, 0x0e98450eUL, 0xe3c046e3UL, 0xb82f47b8UL, 0x5a7e485aUL, 0x01914901UL, 0xecc94aecUL, 0xb7264bb7UL, 0x5f794c5fUL, 0x04964d04UL, 0xe9ce4ee9UL, 0xb2214fb2UL, 0x446c5044UL, 0x1f83511fUL, 0xf2db52f2UL, 0xa93453a9UL, 0x416b5441UL, 0x1a84551aUL, 0xf7dc56f7UL, 0xac3357acUL, 0x4e62584eUL, 0x158d5915UL, 0xf8d55af8UL, 0xa33a5ba3UL, 0x4b655c4bUL, 0x108a5d10UL, 0xfdd25efdUL, 0xa63d5fa6UL, 0x78486078UL, 0x23a76123UL, 0xceff62ceUL, 0x95106395UL, 0x7d4f647dUL, 0x26a06526UL, 0xcbf866cbUL, 0x90176790UL, 0x72466872UL, 0x29a96929UL, 0xc4f16ac4UL, 0x9f1e6b9fUL, 0x77416c77UL, 0x2cae6d2cUL, 0xc1f66ec1UL, 0x9a196f9aUL, 0x6c54706cUL, 0x37bb7137UL, 0xdae372daUL, 0x810c7381UL, 0x69537469UL, 0x32bc7532UL, 0xdfe476dfUL, 0x840b7784UL, 0x665a7866UL, 0x3db5793dUL, 0xd0ed7ad0UL, 0x8b027b8bUL, 0x635d7c63UL, 0x38b27d38UL, 0xd5ea7ed5UL, 0x8e057f8eUL, 0xa0e080a0UL, 0xfb0f81fbUL, 0x16578216UL, 0x4db8834dUL, 0xa5e784a5UL, 0xfe0885feUL, 0x13508613UL, 0x48bf8748UL, 0xaaee88aaUL, 0xf10189f1UL, 0x1c598a1cUL, 0x47b68b47UL, 0xafe98cafUL, 0xf4068df4UL, 0x195e8e19UL, 0x42b18f42UL, 0xb4fc90b4UL, 0xef1391efUL, 0x024b9202UL, 0x59a49359UL, 0xb1fb94b1UL, 0xea1495eaUL, 0x074c9607UL, 0x5ca3975cUL, 0xbef298beUL, 0xe51d99e5UL, 0x08459a08UL, 0x53aa9b53UL, 0xbbf59cbbUL, 0xe01a9de0UL, 0x0d429e0dUL, 0x56ad9f56UL, 0x88d8a088UL, 0xd337a1d3UL, 0x3e6fa23eUL, 0x6580a365UL, 0x8ddfa48dUL, 0xd630a5d6UL, 0x3b68a63bUL, 0x6087a760UL, 0x82d6a882UL, 0xd939a9d9UL, 0x3461aa34UL, 0x6f8eab6fUL, 0x87d1ac87UL, 0xdc3eaddcUL, 0x3166ae31UL, 0x6a89af6aUL, 0x9cc4b09cUL, 0xc72bb1c7UL, 0x2a73b22aUL, 0x719cb371UL, 0x99c3b499UL, 0xc22cb5c2UL, 0x2f74b62fUL, 0x749bb774UL, 0x96cab896UL, 0xcd25b9cdUL, 0x207dba20UL, 0x7b92bb7bUL, 0x93cdbc93UL, 0xc822bdc8UL, 0x257abe25UL, 0x7e95bf7eUL, 0xf090c0f0UL, 0xab7fc1abUL, 0x4627c246UL, 0x1dc8c31dUL, 0xf597c4f5UL, 0xae78c5aeUL, 0x4320c643UL, 0x18cfc718UL, 0xfa9ec8faUL, 0xa171c9a1UL, 0x4c29ca4cUL, 0x17c6cb17UL, 0xff99ccffUL, 0xa476cda4UL, 0x492ece49UL, 0x12c1cf12UL, 0xe48cd0e4UL, 0xbf63d1bfUL, 0x523bd252UL, 0x09d4d309UL, 0xe18bd4e1UL, 0xba64d5baUL, 0x573cd657UL, 0x0cd3d70cUL, 0xee82d8eeUL, 0xb56dd9b5UL, 0x5835da58UL, 0x03dadb03UL, 0xeb85dcebUL, 0xb06addb0UL, 0x5d32de5dUL, 0x06dddf06UL, 0xd8a8e0d8UL, 0x8347e183UL, 0x6e1fe26eUL, 0x35f0e335UL, 0xddafe4ddUL, 0x8640e586UL, 0x6b18e66bUL, 0x30f7e730UL, 0xd2a6e8d2UL, 0x8949e989UL, 0x6411ea64UL, 0x3ffeeb3fUL, 0xd7a1ecd7UL, 0x8c4eed8cUL, 0x6116ee61UL, 0x3af9ef3aUL, 0xccb4f0ccUL, 0x975bf197UL, 0x7a03f27aUL, 0x21ecf321UL, 0xc9b3f4c9UL, 0x925cf592UL, 0x7f04f67fUL, 0x24ebf724UL, 0xc6baf8c6UL, 0x9d55f99dUL, 0x700dfa70UL, 0x2be2fb2bUL, 0xc3bdfcc3UL, 0x9852fd98UL, 0x750afe75UL, 0x2ee5ff2eUL }}; #ifdef LTC_TWOFISH_ALL_TABLES /* the 4x8 RS transform */ static const ulong32 rs_tab0[256] = { 0x00000000LU, 0xa402a401LU, 0x05040502LU, 0xa106a103LU, 0x0a080a04LU, 0xae0aae05LU, 0x0f0c0f06LU, 0xab0eab07LU, 0x14101408LU, 0xb012b009LU, 0x1114110aLU, 0xb516b50bLU, 0x1e181e0cLU, 0xba1aba0dLU, 0x1b1c1b0eLU, 0xbf1ebf0fLU, 0x28202810LU, 0x8c228c11LU, 0x2d242d12LU, 0x89268913LU, 0x22282214LU, 0x862a8615LU, 0x272c2716LU, 0x832e8317LU, 0x3c303c18LU, 0x98329819LU, 0x3934391aLU, 0x9d369d1bLU, 0x3638361cLU, 0x923a921dLU, 0x333c331eLU, 0x973e971fLU, 0x50405020LU, 0xf442f421LU, 0x55445522LU, 0xf146f123LU, 0x5a485a24LU, 0xfe4afe25LU, 0x5f4c5f26LU, 0xfb4efb27LU, 0x44504428LU, 0xe052e029LU, 0x4154412aLU, 0xe556e52bLU, 0x4e584e2cLU, 0xea5aea2dLU, 0x4b5c4b2eLU, 0xef5eef2fLU, 0x78607830LU, 0xdc62dc31LU, 0x7d647d32LU, 0xd966d933LU, 0x72687234LU, 0xd66ad635LU, 0x776c7736LU, 0xd36ed337LU, 0x6c706c38LU, 0xc872c839LU, 0x6974693aLU, 0xcd76cd3bLU, 0x6678663cLU, 0xc27ac23dLU, 0x637c633eLU, 0xc77ec73fLU, 0xa080a040LU, 0x04820441LU, 0xa584a542LU, 0x01860143LU, 0xaa88aa44LU, 0x0e8a0e45LU, 0xaf8caf46LU, 0x0b8e0b47LU, 0xb490b448LU, 0x10921049LU, 0xb194b14aLU, 0x1596154bLU, 0xbe98be4cLU, 0x1a9a1a4dLU, 0xbb9cbb4eLU, 0x1f9e1f4fLU, 0x88a08850LU, 0x2ca22c51LU, 0x8da48d52LU, 0x29a62953LU, 0x82a88254LU, 0x26aa2655LU, 0x87ac8756LU, 0x23ae2357LU, 0x9cb09c58LU, 0x38b23859LU, 0x99b4995aLU, 0x3db63d5bLU, 0x96b8965cLU, 0x32ba325dLU, 0x93bc935eLU, 0x37be375fLU, 0xf0c0f060LU, 0x54c25461LU, 0xf5c4f562LU, 0x51c65163LU, 0xfac8fa64LU, 0x5eca5e65LU, 0xffccff66LU, 0x5bce5b67LU, 0xe4d0e468LU, 0x40d24069LU, 0xe1d4e16aLU, 0x45d6456bLU, 0xeed8ee6cLU, 0x4ada4a6dLU, 0xebdceb6eLU, 0x4fde4f6fLU, 0xd8e0d870LU, 0x7ce27c71LU, 0xdde4dd72LU, 0x79e67973LU, 0xd2e8d274LU, 0x76ea7675LU, 0xd7ecd776LU, 0x73ee7377LU, 0xccf0cc78LU, 0x68f26879LU, 0xc9f4c97aLU, 0x6df66d7bLU, 0xc6f8c67cLU, 0x62fa627dLU, 0xc3fcc37eLU, 0x67fe677fLU, 0x0d4d0d80LU, 0xa94fa981LU, 0x08490882LU, 0xac4bac83LU, 0x07450784LU, 0xa347a385LU, 0x02410286LU, 0xa643a687LU, 0x195d1988LU, 0xbd5fbd89LU, 0x1c591c8aLU, 0xb85bb88bLU, 0x1355138cLU, 0xb757b78dLU, 0x1651168eLU, 0xb253b28fLU, 0x256d2590LU, 0x816f8191LU, 0x20692092LU, 0x846b8493LU, 0x2f652f94LU, 0x8b678b95LU, 0x2a612a96LU, 0x8e638e97LU, 0x317d3198LU, 0x957f9599LU, 0x3479349aLU, 0x907b909bLU, 0x3b753b9cLU, 0x9f779f9dLU, 0x3e713e9eLU, 0x9a739a9fLU, 0x5d0d5da0LU, 0xf90ff9a1LU, 0x580958a2LU, 0xfc0bfca3LU, 0x570557a4LU, 0xf307f3a5LU, 0x520152a6LU, 0xf603f6a7LU, 0x491d49a8LU, 0xed1feda9LU, 0x4c194caaLU, 0xe81be8abLU, 0x431543acLU, 0xe717e7adLU, 0x461146aeLU, 0xe213e2afLU, 0x752d75b0LU, 0xd12fd1b1LU, 0x702970b2LU, 0xd42bd4b3LU, 0x7f257fb4LU, 0xdb27dbb5LU, 0x7a217ab6LU, 0xde23deb7LU, 0x613d61b8LU, 0xc53fc5b9LU, 0x643964baLU, 0xc03bc0bbLU, 0x6b356bbcLU, 0xcf37cfbdLU, 0x6e316ebeLU, 0xca33cabfLU, 0xadcdadc0LU, 0x09cf09c1LU, 0xa8c9a8c2LU, 0x0ccb0cc3LU, 0xa7c5a7c4LU, 0x03c703c5LU, 0xa2c1a2c6LU, 0x06c306c7LU, 0xb9ddb9c8LU, 0x1ddf1dc9LU, 0xbcd9bccaLU, 0x18db18cbLU, 0xb3d5b3ccLU, 0x17d717cdLU, 0xb6d1b6ceLU, 0x12d312cfLU, 0x85ed85d0LU, 0x21ef21d1LU, 0x80e980d2LU, 0x24eb24d3LU, 0x8fe58fd4LU, 0x2be72bd5LU, 0x8ae18ad6LU, 0x2ee32ed7LU, 0x91fd91d8LU, 0x35ff35d9LU, 0x94f994daLU, 0x30fb30dbLU, 0x9bf59bdcLU, 0x3ff73fddLU, 0x9ef19edeLU, 0x3af33adfLU, 0xfd8dfde0LU, 0x598f59e1LU, 0xf889f8e2LU, 0x5c8b5ce3LU, 0xf785f7e4LU, 0x538753e5LU, 0xf281f2e6LU, 0x568356e7LU, 0xe99de9e8LU, 0x4d9f4de9LU, 0xec99eceaLU, 0x489b48ebLU, 0xe395e3ecLU, 0x479747edLU, 0xe691e6eeLU, 0x429342efLU, 0xd5add5f0LU, 0x71af71f1LU, 0xd0a9d0f2LU, 0x74ab74f3LU, 0xdfa5dff4LU, 0x7ba77bf5LU, 0xdaa1daf6LU, 0x7ea37ef7LU, 0xc1bdc1f8LU, 0x65bf65f9LU, 0xc4b9c4faLU, 0x60bb60fbLU, 0xcbb5cbfcLU, 0x6fb76ffdLU, 0xceb1cefeLU, 0x6ab36affLU }; static const ulong32 rs_tab1[256] = { 0x00000000LU, 0x55a156a4LU, 0xaa0fac05LU, 0xffaefaa1LU, 0x191e150aLU, 0x4cbf43aeLU, 0xb311b90fLU, 0xe6b0efabLU, 0x323c2a14LU, 0x679d7cb0LU, 0x98338611LU, 0xcd92d0b5LU, 0x2b223f1eLU, 0x7e8369baLU, 0x812d931bLU, 0xd48cc5bfLU, 0x64785428LU, 0x31d9028cLU, 0xce77f82dLU, 0x9bd6ae89LU, 0x7d664122LU, 0x28c71786LU, 0xd769ed27LU, 0x82c8bb83LU, 0x56447e3cLU, 0x03e52898LU, 0xfc4bd239LU, 0xa9ea849dLU, 0x4f5a6b36LU, 0x1afb3d92LU, 0xe555c733LU, 0xb0f49197LU, 0xc8f0a850LU, 0x9d51fef4LU, 0x62ff0455LU, 0x375e52f1LU, 0xd1eebd5aLU, 0x844febfeLU, 0x7be1115fLU, 0x2e4047fbLU, 0xfacc8244LU, 0xaf6dd4e0LU, 0x50c32e41LU, 0x056278e5LU, 0xe3d2974eLU, 0xb673c1eaLU, 0x49dd3b4bLU, 0x1c7c6defLU, 0xac88fc78LU, 0xf929aadcLU, 0x0687507dLU, 0x532606d9LU, 0xb596e972LU, 0xe037bfd6LU, 0x1f994577LU, 0x4a3813d3LU, 0x9eb4d66cLU, 0xcb1580c8LU, 0x34bb7a69LU, 0x611a2ccdLU, 0x87aac366LU, 0xd20b95c2LU, 0x2da56f63LU, 0x780439c7LU, 0xddad1da0LU, 0x880c4b04LU, 0x77a2b1a5LU, 0x2203e701LU, 0xc4b308aaLU, 0x91125e0eLU, 0x6ebca4afLU, 0x3b1df20bLU, 0xef9137b4LU, 0xba306110LU, 0x459e9bb1LU, 0x103fcd15LU, 0xf68f22beLU, 0xa32e741aLU, 0x5c808ebbLU, 0x0921d81fLU, 0xb9d54988LU, 0xec741f2cLU, 0x13dae58dLU, 0x467bb329LU, 0xa0cb5c82LU, 0xf56a0a26LU, 0x0ac4f087LU, 0x5f65a623LU, 0x8be9639cLU, 0xde483538LU, 0x21e6cf99LU, 0x7447993dLU, 0x92f77696LU, 0xc7562032LU, 0x38f8da93LU, 0x6d598c37LU, 0x155db5f0LU, 0x40fce354LU, 0xbf5219f5LU, 0xeaf34f51LU, 0x0c43a0faLU, 0x59e2f65eLU, 0xa64c0cffLU, 0xf3ed5a5bLU, 0x27619fe4LU, 0x72c0c940LU, 0x8d6e33e1LU, 0xd8cf6545LU, 0x3e7f8aeeLU, 0x6bdedc4aLU, 0x947026ebLU, 0xc1d1704fLU, 0x7125e1d8LU, 0x2484b77cLU, 0xdb2a4dddLU, 0x8e8b1b79LU, 0x683bf4d2LU, 0x3d9aa276LU, 0xc23458d7LU, 0x97950e73LU, 0x4319cbccLU, 0x16b89d68LU, 0xe91667c9LU, 0xbcb7316dLU, 0x5a07dec6LU, 0x0fa68862LU, 0xf00872c3LU, 0xa5a92467LU, 0xf7173a0dLU, 0xa2b66ca9LU, 0x5d189608LU, 0x08b9c0acLU, 0xee092f07LU, 0xbba879a3LU, 0x44068302LU, 0x11a7d5a6LU, 0xc52b1019LU, 0x908a46bdLU, 0x6f24bc1cLU, 0x3a85eab8LU, 0xdc350513LU, 0x899453b7LU, 0x763aa916LU, 0x239bffb2LU, 0x936f6e25LU, 0xc6ce3881LU, 0x3960c220LU, 0x6cc19484LU, 0x8a717b2fLU, 0xdfd02d8bLU, 0x207ed72aLU, 0x75df818eLU, 0xa1534431LU, 0xf4f21295LU, 0x0b5ce834LU, 0x5efdbe90LU, 0xb84d513bLU, 0xedec079fLU, 0x1242fd3eLU, 0x47e3ab9aLU, 0x3fe7925dLU, 0x6a46c4f9LU, 0x95e83e58LU, 0xc04968fcLU, 0x26f98757LU, 0x7358d1f3LU, 0x8cf62b52LU, 0xd9577df6LU, 0x0ddbb849LU, 0x587aeeedLU, 0xa7d4144cLU, 0xf27542e8LU, 0x14c5ad43LU, 0x4164fbe7LU, 0xbeca0146LU, 0xeb6b57e2LU, 0x5b9fc675LU, 0x0e3e90d1LU, 0xf1906a70LU, 0xa4313cd4LU, 0x4281d37fLU, 0x172085dbLU, 0xe88e7f7aLU, 0xbd2f29deLU, 0x69a3ec61LU, 0x3c02bac5LU, 0xc3ac4064LU, 0x960d16c0LU, 0x70bdf96bLU, 0x251cafcfLU, 0xdab2556eLU, 0x8f1303caLU, 0x2aba27adLU, 0x7f1b7109LU, 0x80b58ba8LU, 0xd514dd0cLU, 0x33a432a7LU, 0x66056403LU, 0x99ab9ea2LU, 0xcc0ac806LU, 0x18860db9LU, 0x4d275b1dLU, 0xb289a1bcLU, 0xe728f718LU, 0x019818b3LU, 0x54394e17LU, 0xab97b4b6LU, 0xfe36e212LU, 0x4ec27385LU, 0x1b632521LU, 0xe4cddf80LU, 0xb16c8924LU, 0x57dc668fLU, 0x027d302bLU, 0xfdd3ca8aLU, 0xa8729c2eLU, 0x7cfe5991LU, 0x295f0f35LU, 0xd6f1f594LU, 0x8350a330LU, 0x65e04c9bLU, 0x30411a3fLU, 0xcfefe09eLU, 0x9a4eb63aLU, 0xe24a8ffdLU, 0xb7ebd959LU, 0x484523f8LU, 0x1de4755cLU, 0xfb549af7LU, 0xaef5cc53LU, 0x515b36f2LU, 0x04fa6056LU, 0xd076a5e9LU, 0x85d7f34dLU, 0x7a7909ecLU, 0x2fd85f48LU, 0xc968b0e3LU, 0x9cc9e647LU, 0x63671ce6LU, 0x36c64a42LU, 0x8632dbd5LU, 0xd3938d71LU, 0x2c3d77d0LU, 0x799c2174LU, 0x9f2ccedfLU, 0xca8d987bLU, 0x352362daLU, 0x6082347eLU, 0xb40ef1c1LU, 0xe1afa765LU, 0x1e015dc4LU, 0x4ba00b60LU, 0xad10e4cbLU, 0xf8b1b26fLU, 0x071f48ceLU, 0x52be1e6aLU }; static const ulong32 rs_tab2[256] = { 0x00000000LU, 0x87fc8255LU, 0x43b549aaLU, 0xc449cbffLU, 0x86279219LU, 0x01db104cLU, 0xc592dbb3LU, 0x426e59e6LU, 0x414e6932LU, 0xc6b2eb67LU, 0x02fb2098LU, 0x8507a2cdLU, 0xc769fb2bLU, 0x4095797eLU, 0x84dcb281LU, 0x032030d4LU, 0x829cd264LU, 0x05605031LU, 0xc1299bceLU, 0x46d5199bLU, 0x04bb407dLU, 0x8347c228LU, 0x470e09d7LU, 0xc0f28b82LU, 0xc3d2bb56LU, 0x442e3903LU, 0x8067f2fcLU, 0x079b70a9LU, 0x45f5294fLU, 0xc209ab1aLU, 0x064060e5LU, 0x81bce2b0LU, 0x4975e9c8LU, 0xce896b9dLU, 0x0ac0a062LU, 0x8d3c2237LU, 0xcf527bd1LU, 0x48aef984LU, 0x8ce7327bLU, 0x0b1bb02eLU, 0x083b80faLU, 0x8fc702afLU, 0x4b8ec950LU, 0xcc724b05LU, 0x8e1c12e3LU, 0x09e090b6LU, 0xcda95b49LU, 0x4a55d91cLU, 0xcbe93bacLU, 0x4c15b9f9LU, 0x885c7206LU, 0x0fa0f053LU, 0x4dcea9b5LU, 0xca322be0LU, 0x0e7be01fLU, 0x8987624aLU, 0x8aa7529eLU, 0x0d5bd0cbLU, 0xc9121b34LU, 0x4eee9961LU, 0x0c80c087LU, 0x8b7c42d2LU, 0x4f35892dLU, 0xc8c90b78LU, 0x92ea9fddLU, 0x15161d88LU, 0xd15fd677LU, 0x56a35422LU, 0x14cd0dc4LU, 0x93318f91LU, 0x5778446eLU, 0xd084c63bLU, 0xd3a4f6efLU, 0x545874baLU, 0x9011bf45LU, 0x17ed3d10LU, 0x558364f6LU, 0xd27fe6a3LU, 0x16362d5cLU, 0x91caaf09LU, 0x10764db9LU, 0x978acfecLU, 0x53c30413LU, 0xd43f8646LU, 0x9651dfa0LU, 0x11ad5df5LU, 0xd5e4960aLU, 0x5218145fLU, 0x5138248bLU, 0xd6c4a6deLU, 0x128d6d21LU, 0x9571ef74LU, 0xd71fb692LU, 0x50e334c7LU, 0x94aaff38LU, 0x13567d6dLU, 0xdb9f7615LU, 0x5c63f440LU, 0x982a3fbfLU, 0x1fd6bdeaLU, 0x5db8e40cLU, 0xda446659LU, 0x1e0dada6LU, 0x99f12ff3LU, 0x9ad11f27LU, 0x1d2d9d72LU, 0xd964568dLU, 0x5e98d4d8LU, 0x1cf68d3eLU, 0x9b0a0f6bLU, 0x5f43c494LU, 0xd8bf46c1LU, 0x5903a471LU, 0xdeff2624LU, 0x1ab6eddbLU, 0x9d4a6f8eLU, 0xdf243668LU, 0x58d8b43dLU, 0x9c917fc2LU, 0x1b6dfd97LU, 0x184dcd43LU, 0x9fb14f16LU, 0x5bf884e9LU, 0xdc0406bcLU, 0x9e6a5f5aLU, 0x1996dd0fLU, 0xdddf16f0LU, 0x5a2394a5LU, 0x699973f7LU, 0xee65f1a2LU, 0x2a2c3a5dLU, 0xadd0b808LU, 0xefbee1eeLU, 0x684263bbLU, 0xac0ba844LU, 0x2bf72a11LU, 0x28d71ac5LU, 0xaf2b9890LU, 0x6b62536fLU, 0xec9ed13aLU, 0xaef088dcLU, 0x290c0a89LU, 0xed45c176LU, 0x6ab94323LU, 0xeb05a193LU, 0x6cf923c6LU, 0xa8b0e839LU, 0x2f4c6a6cLU, 0x6d22338aLU, 0xeadeb1dfLU, 0x2e977a20LU, 0xa96bf875LU, 0xaa4bc8a1LU, 0x2db74af4LU, 0xe9fe810bLU, 0x6e02035eLU, 0x2c6c5ab8LU, 0xab90d8edLU, 0x6fd91312LU, 0xe8259147LU, 0x20ec9a3fLU, 0xa710186aLU, 0x6359d395LU, 0xe4a551c0LU, 0xa6cb0826LU, 0x21378a73LU, 0xe57e418cLU, 0x6282c3d9LU, 0x61a2f30dLU, 0xe65e7158LU, 0x2217baa7LU, 0xa5eb38f2LU, 0xe7856114LU, 0x6079e341LU, 0xa43028beLU, 0x23ccaaebLU, 0xa270485bLU, 0x258cca0eLU, 0xe1c501f1LU, 0x663983a4LU, 0x2457da42LU, 0xa3ab5817LU, 0x67e293e8LU, 0xe01e11bdLU, 0xe33e2169LU, 0x64c2a33cLU, 0xa08b68c3LU, 0x2777ea96LU, 0x6519b370LU, 0xe2e53125LU, 0x26acfadaLU, 0xa150788fLU, 0xfb73ec2aLU, 0x7c8f6e7fLU, 0xb8c6a580LU, 0x3f3a27d5LU, 0x7d547e33LU, 0xfaa8fc66LU, 0x3ee13799LU, 0xb91db5ccLU, 0xba3d8518LU, 0x3dc1074dLU, 0xf988ccb2LU, 0x7e744ee7LU, 0x3c1a1701LU, 0xbbe69554LU, 0x7faf5eabLU, 0xf853dcfeLU, 0x79ef3e4eLU, 0xfe13bc1bLU, 0x3a5a77e4LU, 0xbda6f5b1LU, 0xffc8ac57LU, 0x78342e02LU, 0xbc7de5fdLU, 0x3b8167a8LU, 0x38a1577cLU, 0xbf5dd529LU, 0x7b141ed6LU, 0xfce89c83LU, 0xbe86c565LU, 0x397a4730LU, 0xfd338ccfLU, 0x7acf0e9aLU, 0xb20605e2LU, 0x35fa87b7LU, 0xf1b34c48LU, 0x764fce1dLU, 0x342197fbLU, 0xb3dd15aeLU, 0x7794de51LU, 0xf0685c04LU, 0xf3486cd0LU, 0x74b4ee85LU, 0xb0fd257aLU, 0x3701a72fLU, 0x756ffec9LU, 0xf2937c9cLU, 0x36dab763LU, 0xb1263536LU, 0x309ad786LU, 0xb76655d3LU, 0x732f9e2cLU, 0xf4d31c79LU, 0xb6bd459fLU, 0x3141c7caLU, 0xf5080c35LU, 0x72f48e60LU, 0x71d4beb4LU, 0xf6283ce1LU, 0x3261f71eLU, 0xb59d754bLU, 0xf7f32cadLU, 0x700faef8LU, 0xb4466507LU, 0x33bae752LU }; static const ulong32 rs_tab3[256] = { 0x00000000LU, 0x5ac1f387LU, 0xb4cfab43LU, 0xee0e58c4LU, 0x25d31b86LU, 0x7f12e801LU, 0x911cb0c5LU, 0xcbdd4342LU, 0x4aeb3641LU, 0x102ac5c6LU, 0xfe249d02LU, 0xa4e56e85LU, 0x6f382dc7LU, 0x35f9de40LU, 0xdbf78684LU, 0x81367503LU, 0x949b6c82LU, 0xce5a9f05LU, 0x2054c7c1LU, 0x7a953446LU, 0xb1487704LU, 0xeb898483LU, 0x0587dc47LU, 0x5f462fc0LU, 0xde705ac3LU, 0x84b1a944LU, 0x6abff180LU, 0x307e0207LU, 0xfba34145LU, 0xa162b2c2LU, 0x4f6cea06LU, 0x15ad1981LU, 0x657bd849LU, 0x3fba2bceLU, 0xd1b4730aLU, 0x8b75808dLU, 0x40a8c3cfLU, 0x1a693048LU, 0xf467688cLU, 0xaea69b0bLU, 0x2f90ee08LU, 0x75511d8fLU, 0x9b5f454bLU, 0xc19eb6ccLU, 0x0a43f58eLU, 0x50820609LU, 0xbe8c5ecdLU, 0xe44dad4aLU, 0xf1e0b4cbLU, 0xab21474cLU, 0x452f1f88LU, 0x1feeec0fLU, 0xd433af4dLU, 0x8ef25ccaLU, 0x60fc040eLU, 0x3a3df789LU, 0xbb0b828aLU, 0xe1ca710dLU, 0x0fc429c9LU, 0x5505da4eLU, 0x9ed8990cLU, 0xc4196a8bLU, 0x2a17324fLU, 0x70d6c1c8LU, 0xcaf6fd92LU, 0x90370e15LU, 0x7e3956d1LU, 0x24f8a556LU, 0xef25e614LU, 0xb5e41593LU, 0x5bea4d57LU, 0x012bbed0LU, 0x801dcbd3LU, 0xdadc3854LU, 0x34d26090LU, 0x6e139317LU, 0xa5ced055LU, 0xff0f23d2LU, 0x11017b16LU, 0x4bc08891LU, 0x5e6d9110LU, 0x04ac6297LU, 0xeaa23a53LU, 0xb063c9d4LU, 0x7bbe8a96LU, 0x217f7911LU, 0xcf7121d5LU, 0x95b0d252LU, 0x1486a751LU, 0x4e4754d6LU, 0xa0490c12LU, 0xfa88ff95LU, 0x3155bcd7LU, 0x6b944f50LU, 0x859a1794LU, 0xdf5be413LU, 0xaf8d25dbLU, 0xf54cd65cLU, 0x1b428e98LU, 0x41837d1fLU, 0x8a5e3e5dLU, 0xd09fcddaLU, 0x3e91951eLU, 0x64506699LU, 0xe566139aLU, 0xbfa7e01dLU, 0x51a9b8d9LU, 0x0b684b5eLU, 0xc0b5081cLU, 0x9a74fb9bLU, 0x747aa35fLU, 0x2ebb50d8LU, 0x3b164959LU, 0x61d7badeLU, 0x8fd9e21aLU, 0xd518119dLU, 0x1ec552dfLU, 0x4404a158LU, 0xaa0af99cLU, 0xf0cb0a1bLU, 0x71fd7f18LU, 0x2b3c8c9fLU, 0xc532d45bLU, 0x9ff327dcLU, 0x542e649eLU, 0x0eef9719LU, 0xe0e1cfddLU, 0xba203c5aLU, 0xd9a1b769LU, 0x836044eeLU, 0x6d6e1c2aLU, 0x37afefadLU, 0xfc72acefLU, 0xa6b35f68LU, 0x48bd07acLU, 0x127cf42bLU, 0x934a8128LU, 0xc98b72afLU, 0x27852a6bLU, 0x7d44d9ecLU, 0xb6999aaeLU, 0xec586929LU, 0x025631edLU, 0x5897c26aLU, 0x4d3adbebLU, 0x17fb286cLU, 0xf9f570a8LU, 0xa334832fLU, 0x68e9c06dLU, 0x322833eaLU, 0xdc266b2eLU, 0x86e798a9LU, 0x07d1edaaLU, 0x5d101e2dLU, 0xb31e46e9LU, 0xe9dfb56eLU, 0x2202f62cLU, 0x78c305abLU, 0x96cd5d6fLU, 0xcc0caee8LU, 0xbcda6f20LU, 0xe61b9ca7LU, 0x0815c463LU, 0x52d437e4LU, 0x990974a6LU, 0xc3c88721LU, 0x2dc6dfe5LU, 0x77072c62LU, 0xf6315961LU, 0xacf0aae6LU, 0x42fef222LU, 0x183f01a5LU, 0xd3e242e7LU, 0x8923b160LU, 0x672de9a4LU, 0x3dec1a23LU, 0x284103a2LU, 0x7280f025LU, 0x9c8ea8e1LU, 0xc64f5b66LU, 0x0d921824LU, 0x5753eba3LU, 0xb95db367LU, 0xe39c40e0LU, 0x62aa35e3LU, 0x386bc664LU, 0xd6659ea0LU, 0x8ca46d27LU, 0x47792e65LU, 0x1db8dde2LU, 0xf3b68526LU, 0xa97776a1LU, 0x13574afbLU, 0x4996b97cLU, 0xa798e1b8LU, 0xfd59123fLU, 0x3684517dLU, 0x6c45a2faLU, 0x824bfa3eLU, 0xd88a09b9LU, 0x59bc7cbaLU, 0x037d8f3dLU, 0xed73d7f9LU, 0xb7b2247eLU, 0x7c6f673cLU, 0x26ae94bbLU, 0xc8a0cc7fLU, 0x92613ff8LU, 0x87cc2679LU, 0xdd0dd5feLU, 0x33038d3aLU, 0x69c27ebdLU, 0xa21f3dffLU, 0xf8dece78LU, 0x16d096bcLU, 0x4c11653bLU, 0xcd271038LU, 0x97e6e3bfLU, 0x79e8bb7bLU, 0x232948fcLU, 0xe8f40bbeLU, 0xb235f839LU, 0x5c3ba0fdLU, 0x06fa537aLU, 0x762c92b2LU, 0x2ced6135LU, 0xc2e339f1LU, 0x9822ca76LU, 0x53ff8934LU, 0x093e7ab3LU, 0xe7302277LU, 0xbdf1d1f0LU, 0x3cc7a4f3LU, 0x66065774LU, 0x88080fb0LU, 0xd2c9fc37LU, 0x1914bf75LU, 0x43d54cf2LU, 0xaddb1436LU, 0xf71ae7b1LU, 0xe2b7fe30LU, 0xb8760db7LU, 0x56785573LU, 0x0cb9a6f4LU, 0xc764e5b6LU, 0x9da51631LU, 0x73ab4ef5LU, 0x296abd72LU, 0xa85cc871LU, 0xf29d3bf6LU, 0x1c936332LU, 0x465290b5LU, 0x8d8fd3f7LU, 0xd74e2070LU, 0x394078b4LU, 0x63818b33LU }; static const ulong32 rs_tab4[256] = { 0x00000000LU, 0x58471e5aLU, 0xb08e3cb4LU, 0xe8c922eeLU, 0x2d517825LU, 0x7516667fLU, 0x9ddf4491LU, 0xc5985acbLU, 0x5aa2f04aLU, 0x02e5ee10LU, 0xea2cccfeLU, 0xb26bd2a4LU, 0x77f3886fLU, 0x2fb49635LU, 0xc77db4dbLU, 0x9f3aaa81LU, 0xb409ad94LU, 0xec4eb3ceLU, 0x04879120LU, 0x5cc08f7aLU, 0x9958d5b1LU, 0xc11fcbebLU, 0x29d6e905LU, 0x7191f75fLU, 0xeeab5ddeLU, 0xb6ec4384LU, 0x5e25616aLU, 0x06627f30LU, 0xc3fa25fbLU, 0x9bbd3ba1LU, 0x7374194fLU, 0x2b330715LU, 0x25121765LU, 0x7d55093fLU, 0x959c2bd1LU, 0xcddb358bLU, 0x08436f40LU, 0x5004711aLU, 0xb8cd53f4LU, 0xe08a4daeLU, 0x7fb0e72fLU, 0x27f7f975LU, 0xcf3edb9bLU, 0x9779c5c1LU, 0x52e19f0aLU, 0x0aa68150LU, 0xe26fa3beLU, 0xba28bde4LU, 0x911bbaf1LU, 0xc95ca4abLU, 0x21958645LU, 0x79d2981fLU, 0xbc4ac2d4LU, 0xe40ddc8eLU, 0x0cc4fe60LU, 0x5483e03aLU, 0xcbb94abbLU, 0x93fe54e1LU, 0x7b37760fLU, 0x23706855LU, 0xe6e8329eLU, 0xbeaf2cc4LU, 0x56660e2aLU, 0x0e211070LU, 0x4a242ecaLU, 0x12633090LU, 0xfaaa127eLU, 0xa2ed0c24LU, 0x677556efLU, 0x3f3248b5LU, 0xd7fb6a5bLU, 0x8fbc7401LU, 0x1086de80LU, 0x48c1c0daLU, 0xa008e234LU, 0xf84ffc6eLU, 0x3dd7a6a5LU, 0x6590b8ffLU, 0x8d599a11LU, 0xd51e844bLU, 0xfe2d835eLU, 0xa66a9d04LU, 0x4ea3bfeaLU, 0x16e4a1b0LU, 0xd37cfb7bLU, 0x8b3be521LU, 0x63f2c7cfLU, 0x3bb5d995LU, 0xa48f7314LU, 0xfcc86d4eLU, 0x14014fa0LU, 0x4c4651faLU, 0x89de0b31LU, 0xd199156bLU, 0x39503785LU, 0x611729dfLU, 0x6f3639afLU, 0x377127f5LU, 0xdfb8051bLU, 0x87ff1b41LU, 0x4267418aLU, 0x1a205fd0LU, 0xf2e97d3eLU, 0xaaae6364LU, 0x3594c9e5LU, 0x6dd3d7bfLU, 0x851af551LU, 0xdd5deb0bLU, 0x18c5b1c0LU, 0x4082af9aLU, 0xa84b8d74LU, 0xf00c932eLU, 0xdb3f943bLU, 0x83788a61LU, 0x6bb1a88fLU, 0x33f6b6d5LU, 0xf66eec1eLU, 0xae29f244LU, 0x46e0d0aaLU, 0x1ea7cef0LU, 0x819d6471LU, 0xd9da7a2bLU, 0x311358c5LU, 0x6954469fLU, 0xaccc1c54LU, 0xf48b020eLU, 0x1c4220e0LU, 0x44053ebaLU, 0x94485cd9LU, 0xcc0f4283LU, 0x24c6606dLU, 0x7c817e37LU, 0xb91924fcLU, 0xe15e3aa6LU, 0x09971848LU, 0x51d00612LU, 0xceeaac93LU, 0x96adb2c9LU, 0x7e649027LU, 0x26238e7dLU, 0xe3bbd4b6LU, 0xbbfccaecLU, 0x5335e802LU, 0x0b72f658LU, 0x2041f14dLU, 0x7806ef17LU, 0x90cfcdf9LU, 0xc888d3a3LU, 0x0d108968LU, 0x55579732LU, 0xbd9eb5dcLU, 0xe5d9ab86LU, 0x7ae30107LU, 0x22a41f5dLU, 0xca6d3db3LU, 0x922a23e9LU, 0x57b27922LU, 0x0ff56778LU, 0xe73c4596LU, 0xbf7b5bccLU, 0xb15a4bbcLU, 0xe91d55e6LU, 0x01d47708LU, 0x59936952LU, 0x9c0b3399LU, 0xc44c2dc3LU, 0x2c850f2dLU, 0x74c21177LU, 0xebf8bbf6LU, 0xb3bfa5acLU, 0x5b768742LU, 0x03319918LU, 0xc6a9c3d3LU, 0x9eeedd89LU, 0x7627ff67LU, 0x2e60e13dLU, 0x0553e628LU, 0x5d14f872LU, 0xb5ddda9cLU, 0xed9ac4c6LU, 0x28029e0dLU, 0x70458057LU, 0x988ca2b9LU, 0xc0cbbce3LU, 0x5ff11662LU, 0x07b60838LU, 0xef7f2ad6LU, 0xb738348cLU, 0x72a06e47LU, 0x2ae7701dLU, 0xc22e52f3LU, 0x9a694ca9LU, 0xde6c7213LU, 0x862b6c49LU, 0x6ee24ea7LU, 0x36a550fdLU, 0xf33d0a36LU, 0xab7a146cLU, 0x43b33682LU, 0x1bf428d8LU, 0x84ce8259LU, 0xdc899c03LU, 0x3440beedLU, 0x6c07a0b7LU, 0xa99ffa7cLU, 0xf1d8e426LU, 0x1911c6c8LU, 0x4156d892LU, 0x6a65df87LU, 0x3222c1ddLU, 0xdaebe333LU, 0x82acfd69LU, 0x4734a7a2LU, 0x1f73b9f8LU, 0xf7ba9b16LU, 0xaffd854cLU, 0x30c72fcdLU, 0x68803197LU, 0x80491379LU, 0xd80e0d23LU, 0x1d9657e8LU, 0x45d149b2LU, 0xad186b5cLU, 0xf55f7506LU, 0xfb7e6576LU, 0xa3397b2cLU, 0x4bf059c2LU, 0x13b74798LU, 0xd62f1d53LU, 0x8e680309LU, 0x66a121e7LU, 0x3ee63fbdLU, 0xa1dc953cLU, 0xf99b8b66LU, 0x1152a988LU, 0x4915b7d2LU, 0x8c8ded19LU, 0xd4caf343LU, 0x3c03d1adLU, 0x6444cff7LU, 0x4f77c8e2LU, 0x1730d6b8LU, 0xfff9f456LU, 0xa7beea0cLU, 0x6226b0c7LU, 0x3a61ae9dLU, 0xd2a88c73LU, 0x8aef9229LU, 0x15d538a8LU, 0x4d9226f2LU, 0xa55b041cLU, 0xfd1c1a46LU, 0x3884408dLU, 0x60c35ed7LU, 0x880a7c39LU, 0xd04d6263LU }; static const ulong32 rs_tab5[256] = { 0x00000000LU, 0xdbaec658LU, 0xfb11c1b0LU, 0x20bf07e8LU, 0xbb22cf2dLU, 0x608c0975LU, 0x40330e9dLU, 0x9b9dc8c5LU, 0x3b44d35aLU, 0xe0ea1502LU, 0xc05512eaLU, 0x1bfbd4b2LU, 0x80661c77LU, 0x5bc8da2fLU, 0x7b77ddc7LU, 0xa0d91b9fLU, 0x7688ebb4LU, 0xad262decLU, 0x8d992a04LU, 0x5637ec5cLU, 0xcdaa2499LU, 0x1604e2c1LU, 0x36bbe529LU, 0xed152371LU, 0x4dcc38eeLU, 0x9662feb6LU, 0xb6ddf95eLU, 0x6d733f06LU, 0xf6eef7c3LU, 0x2d40319bLU, 0x0dff3673LU, 0xd651f02bLU, 0xec5d9b25LU, 0x37f35d7dLU, 0x174c5a95LU, 0xcce29ccdLU, 0x577f5408LU, 0x8cd19250LU, 0xac6e95b8LU, 0x77c053e0LU, 0xd719487fLU, 0x0cb78e27LU, 0x2c0889cfLU, 0xf7a64f97LU, 0x6c3b8752LU, 0xb795410aLU, 0x972a46e2LU, 0x4c8480baLU, 0x9ad57091LU, 0x417bb6c9LU, 0x61c4b121LU, 0xba6a7779LU, 0x21f7bfbcLU, 0xfa5979e4LU, 0xdae67e0cLU, 0x0148b854LU, 0xa191a3cbLU, 0x7a3f6593LU, 0x5a80627bLU, 0x812ea423LU, 0x1ab36ce6LU, 0xc11daabeLU, 0xe1a2ad56LU, 0x3a0c6b0eLU, 0x95ba7b4aLU, 0x4e14bd12LU, 0x6eabbafaLU, 0xb5057ca2LU, 0x2e98b467LU, 0xf536723fLU, 0xd58975d7LU, 0x0e27b38fLU, 0xaefea810LU, 0x75506e48LU, 0x55ef69a0LU, 0x8e41aff8LU, 0x15dc673dLU, 0xce72a165LU, 0xeecda68dLU, 0x356360d5LU, 0xe33290feLU, 0x389c56a6LU, 0x1823514eLU, 0xc38d9716LU, 0x58105fd3LU, 0x83be998bLU, 0xa3019e63LU, 0x78af583bLU, 0xd87643a4LU, 0x03d885fcLU, 0x23678214LU, 0xf8c9444cLU, 0x63548c89LU, 0xb8fa4ad1LU, 0x98454d39LU, 0x43eb8b61LU, 0x79e7e06fLU, 0xa2492637LU, 0x82f621dfLU, 0x5958e787LU, 0xc2c52f42LU, 0x196be91aLU, 0x39d4eef2LU, 0xe27a28aaLU, 0x42a33335LU, 0x990df56dLU, 0xb9b2f285LU, 0x621c34ddLU, 0xf981fc18LU, 0x222f3a40LU, 0x02903da8LU, 0xd93efbf0LU, 0x0f6f0bdbLU, 0xd4c1cd83LU, 0xf47eca6bLU, 0x2fd00c33LU, 0xb44dc4f6LU, 0x6fe302aeLU, 0x4f5c0546LU, 0x94f2c31eLU, 0x342bd881LU, 0xef851ed9LU, 0xcf3a1931LU, 0x1494df69LU, 0x8f0917acLU, 0x54a7d1f4LU, 0x7418d61cLU, 0xafb61044LU, 0x6739f694LU, 0xbc9730ccLU, 0x9c283724LU, 0x4786f17cLU, 0xdc1b39b9LU, 0x07b5ffe1LU, 0x270af809LU, 0xfca43e51LU, 0x5c7d25ceLU, 0x87d3e396LU, 0xa76ce47eLU, 0x7cc22226LU, 0xe75feae3LU, 0x3cf12cbbLU, 0x1c4e2b53LU, 0xc7e0ed0bLU, 0x11b11d20LU, 0xca1fdb78LU, 0xeaa0dc90LU, 0x310e1ac8LU, 0xaa93d20dLU, 0x713d1455LU, 0x518213bdLU, 0x8a2cd5e5LU, 0x2af5ce7aLU, 0xf15b0822LU, 0xd1e40fcaLU, 0x0a4ac992LU, 0x91d70157LU, 0x4a79c70fLU, 0x6ac6c0e7LU, 0xb16806bfLU, 0x8b646db1LU, 0x50caabe9LU, 0x7075ac01LU, 0xabdb6a59LU, 0x3046a29cLU, 0xebe864c4LU, 0xcb57632cLU, 0x10f9a574LU, 0xb020beebLU, 0x6b8e78b3LU, 0x4b317f5bLU, 0x909fb903LU, 0x0b0271c6LU, 0xd0acb79eLU, 0xf013b076LU, 0x2bbd762eLU, 0xfdec8605LU, 0x2642405dLU, 0x06fd47b5LU, 0xdd5381edLU, 0x46ce4928LU, 0x9d608f70LU, 0xbddf8898LU, 0x66714ec0LU, 0xc6a8555fLU, 0x1d069307LU, 0x3db994efLU, 0xe61752b7LU, 0x7d8a9a72LU, 0xa6245c2aLU, 0x869b5bc2LU, 0x5d359d9aLU, 0xf2838ddeLU, 0x292d4b86LU, 0x09924c6eLU, 0xd23c8a36LU, 0x49a142f3LU, 0x920f84abLU, 0xb2b08343LU, 0x691e451bLU, 0xc9c75e84LU, 0x126998dcLU, 0x32d69f34LU, 0xe978596cLU, 0x72e591a9LU, 0xa94b57f1LU, 0x89f45019LU, 0x525a9641LU, 0x840b666aLU, 0x5fa5a032LU, 0x7f1aa7daLU, 0xa4b46182LU, 0x3f29a947LU, 0xe4876f1fLU, 0xc43868f7LU, 0x1f96aeafLU, 0xbf4fb530LU, 0x64e17368LU, 0x445e7480LU, 0x9ff0b2d8LU, 0x046d7a1dLU, 0xdfc3bc45LU, 0xff7cbbadLU, 0x24d27df5LU, 0x1ede16fbLU, 0xc570d0a3LU, 0xe5cfd74bLU, 0x3e611113LU, 0xa5fcd9d6LU, 0x7e521f8eLU, 0x5eed1866LU, 0x8543de3eLU, 0x259ac5a1LU, 0xfe3403f9LU, 0xde8b0411LU, 0x0525c249LU, 0x9eb80a8cLU, 0x4516ccd4LU, 0x65a9cb3cLU, 0xbe070d64LU, 0x6856fd4fLU, 0xb3f83b17LU, 0x93473cffLU, 0x48e9faa7LU, 0xd3743262LU, 0x08daf43aLU, 0x2865f3d2LU, 0xf3cb358aLU, 0x53122e15LU, 0x88bce84dLU, 0xa803efa5LU, 0x73ad29fdLU, 0xe830e138LU, 0x339e2760LU, 0x13212088LU, 0xc88fe6d0LU }; static const ulong32 rs_tab6[256] = { 0x00000000LU, 0x9e3d68dbLU, 0x717ad0fbLU, 0xef47b820LU, 0xe2f4edbbLU, 0x7cc98560LU, 0x938e3d40LU, 0x0db3559bLU, 0x89a5973bLU, 0x1798ffe0LU, 0xf8df47c0LU, 0x66e22f1bLU, 0x6b517a80LU, 0xf56c125bLU, 0x1a2baa7bLU, 0x8416c2a0LU, 0x5f076376LU, 0xc13a0badLU, 0x2e7db38dLU, 0xb040db56LU, 0xbdf38ecdLU, 0x23cee616LU, 0xcc895e36LU, 0x52b436edLU, 0xd6a2f44dLU, 0x489f9c96LU, 0xa7d824b6LU, 0x39e54c6dLU, 0x345619f6LU, 0xaa6b712dLU, 0x452cc90dLU, 0xdb11a1d6LU, 0xbe0ec6ecLU, 0x2033ae37LU, 0xcf741617LU, 0x51497eccLU, 0x5cfa2b57LU, 0xc2c7438cLU, 0x2d80fbacLU, 0xb3bd9377LU, 0x37ab51d7LU, 0xa996390cLU, 0x46d1812cLU, 0xd8ece9f7LU, 0xd55fbc6cLU, 0x4b62d4b7LU, 0xa4256c97LU, 0x3a18044cLU, 0xe109a59aLU, 0x7f34cd41LU, 0x90737561LU, 0x0e4e1dbaLU, 0x03fd4821LU, 0x9dc020faLU, 0x728798daLU, 0xecbaf001LU, 0x68ac32a1LU, 0xf6915a7aLU, 0x19d6e25aLU, 0x87eb8a81LU, 0x8a58df1aLU, 0x1465b7c1LU, 0xfb220fe1LU, 0x651f673aLU, 0x311cc195LU, 0xaf21a94eLU, 0x4066116eLU, 0xde5b79b5LU, 0xd3e82c2eLU, 0x4dd544f5LU, 0xa292fcd5LU, 0x3caf940eLU, 0xb8b956aeLU, 0x26843e75LU, 0xc9c38655LU, 0x57feee8eLU, 0x5a4dbb15LU, 0xc470d3ceLU, 0x2b376beeLU, 0xb50a0335LU, 0x6e1ba2e3LU, 0xf026ca38LU, 0x1f617218LU, 0x815c1ac3LU, 0x8cef4f58LU, 0x12d22783LU, 0xfd959fa3LU, 0x63a8f778LU, 0xe7be35d8LU, 0x79835d03LU, 0x96c4e523LU, 0x08f98df8LU, 0x054ad863LU, 0x9b77b0b8LU, 0x74300898LU, 0xea0d6043LU, 0x8f120779LU, 0x112f6fa2LU, 0xfe68d782LU, 0x6055bf59LU, 0x6de6eac2LU, 0xf3db8219LU, 0x1c9c3a39LU, 0x82a152e2LU, 0x06b79042LU, 0x988af899LU, 0x77cd40b9LU, 0xe9f02862LU, 0xe4437df9LU, 0x7a7e1522LU, 0x9539ad02LU, 0x0b04c5d9LU, 0xd015640fLU, 0x4e280cd4LU, 0xa16fb4f4LU, 0x3f52dc2fLU, 0x32e189b4LU, 0xacdce16fLU, 0x439b594fLU, 0xdda63194LU, 0x59b0f334LU, 0xc78d9befLU, 0x28ca23cfLU, 0xb6f74b14LU, 0xbb441e8fLU, 0x25797654LU, 0xca3ece74LU, 0x5403a6afLU, 0x6238cf67LU, 0xfc05a7bcLU, 0x13421f9cLU, 0x8d7f7747LU, 0x80cc22dcLU, 0x1ef14a07LU, 0xf1b6f227LU, 0x6f8b9afcLU, 0xeb9d585cLU, 0x75a03087LU, 0x9ae788a7LU, 0x04dae07cLU, 0x0969b5e7LU, 0x9754dd3cLU, 0x7813651cLU, 0xe62e0dc7LU, 0x3d3fac11LU, 0xa302c4caLU, 0x4c457ceaLU, 0xd2781431LU, 0xdfcb41aaLU, 0x41f62971LU, 0xaeb19151LU, 0x308cf98aLU, 0xb49a3b2aLU, 0x2aa753f1LU, 0xc5e0ebd1LU, 0x5bdd830aLU, 0x566ed691LU, 0xc853be4aLU, 0x2714066aLU, 0xb9296eb1LU, 0xdc36098bLU, 0x420b6150LU, 0xad4cd970LU, 0x3371b1abLU, 0x3ec2e430LU, 0xa0ff8cebLU, 0x4fb834cbLU, 0xd1855c10LU, 0x55939eb0LU, 0xcbaef66bLU, 0x24e94e4bLU, 0xbad42690LU, 0xb767730bLU, 0x295a1bd0LU, 0xc61da3f0LU, 0x5820cb2bLU, 0x83316afdLU, 0x1d0c0226LU, 0xf24bba06LU, 0x6c76d2ddLU, 0x61c58746LU, 0xfff8ef9dLU, 0x10bf57bdLU, 0x8e823f66LU, 0x0a94fdc6LU, 0x94a9951dLU, 0x7bee2d3dLU, 0xe5d345e6LU, 0xe860107dLU, 0x765d78a6LU, 0x991ac086LU, 0x0727a85dLU, 0x53240ef2LU, 0xcd196629LU, 0x225ede09LU, 0xbc63b6d2LU, 0xb1d0e349LU, 0x2fed8b92LU, 0xc0aa33b2LU, 0x5e975b69LU, 0xda8199c9LU, 0x44bcf112LU, 0xabfb4932LU, 0x35c621e9LU, 0x38757472LU, 0xa6481ca9LU, 0x490fa489LU, 0xd732cc52LU, 0x0c236d84LU, 0x921e055fLU, 0x7d59bd7fLU, 0xe364d5a4LU, 0xeed7803fLU, 0x70eae8e4LU, 0x9fad50c4LU, 0x0190381fLU, 0x8586fabfLU, 0x1bbb9264LU, 0xf4fc2a44LU, 0x6ac1429fLU, 0x67721704LU, 0xf94f7fdfLU, 0x1608c7ffLU, 0x8835af24LU, 0xed2ac81eLU, 0x7317a0c5LU, 0x9c5018e5LU, 0x026d703eLU, 0x0fde25a5LU, 0x91e34d7eLU, 0x7ea4f55eLU, 0xe0999d85LU, 0x648f5f25LU, 0xfab237feLU, 0x15f58fdeLU, 0x8bc8e705LU, 0x867bb29eLU, 0x1846da45LU, 0xf7016265LU, 0x693c0abeLU, 0xb22dab68LU, 0x2c10c3b3LU, 0xc3577b93LU, 0x5d6a1348LU, 0x50d946d3LU, 0xcee42e08LU, 0x21a39628LU, 0xbf9efef3LU, 0x3b883c53LU, 0xa5b55488LU, 0x4af2eca8LU, 0xd4cf8473LU, 0xd97cd1e8LU, 0x4741b933LU, 0xa8060113LU, 0x363b69c8LU }; static const ulong32 rs_tab7[256] = { 0x00000000LU, 0x0319e59eLU, 0x06328771LU, 0x052b62efLU, 0x0c6443e2LU, 0x0f7da67cLU, 0x0a56c493LU, 0x094f210dLU, 0x18c88689LU, 0x1bd16317LU, 0x1efa01f8LU, 0x1de3e466LU, 0x14acc56bLU, 0x17b520f5LU, 0x129e421aLU, 0x1187a784LU, 0x30dd415fLU, 0x33c4a4c1LU, 0x36efc62eLU, 0x35f623b0LU, 0x3cb902bdLU, 0x3fa0e723LU, 0x3a8b85ccLU, 0x39926052LU, 0x2815c7d6LU, 0x2b0c2248LU, 0x2e2740a7LU, 0x2d3ea539LU, 0x24718434LU, 0x276861aaLU, 0x22430345LU, 0x215ae6dbLU, 0x60f782beLU, 0x63ee6720LU, 0x66c505cfLU, 0x65dce051LU, 0x6c93c15cLU, 0x6f8a24c2LU, 0x6aa1462dLU, 0x69b8a3b3LU, 0x783f0437LU, 0x7b26e1a9LU, 0x7e0d8346LU, 0x7d1466d8LU, 0x745b47d5LU, 0x7742a24bLU, 0x7269c0a4LU, 0x7170253aLU, 0x502ac3e1LU, 0x5333267fLU, 0x56184490LU, 0x5501a10eLU, 0x5c4e8003LU, 0x5f57659dLU, 0x5a7c0772LU, 0x5965e2ecLU, 0x48e24568LU, 0x4bfba0f6LU, 0x4ed0c219LU, 0x4dc92787LU, 0x4486068aLU, 0x479fe314LU, 0x42b481fbLU, 0x41ad6465LU, 0xc0a34931LU, 0xc3baacafLU, 0xc691ce40LU, 0xc5882bdeLU, 0xccc70ad3LU, 0xcfdeef4dLU, 0xcaf58da2LU, 0xc9ec683cLU, 0xd86bcfb8LU, 0xdb722a26LU, 0xde5948c9LU, 0xdd40ad57LU, 0xd40f8c5aLU, 0xd71669c4LU, 0xd23d0b2bLU, 0xd124eeb5LU, 0xf07e086eLU, 0xf367edf0LU, 0xf64c8f1fLU, 0xf5556a81LU, 0xfc1a4b8cLU, 0xff03ae12LU, 0xfa28ccfdLU, 0xf9312963LU, 0xe8b68ee7LU, 0xebaf6b79LU, 0xee840996LU, 0xed9dec08LU, 0xe4d2cd05LU, 0xe7cb289bLU, 0xe2e04a74LU, 0xe1f9afeaLU, 0xa054cb8fLU, 0xa34d2e11LU, 0xa6664cfeLU, 0xa57fa960LU, 0xac30886dLU, 0xaf296df3LU, 0xaa020f1cLU, 0xa91bea82LU, 0xb89c4d06LU, 0xbb85a898LU, 0xbeaeca77LU, 0xbdb72fe9LU, 0xb4f80ee4LU, 0xb7e1eb7aLU, 0xb2ca8995LU, 0xb1d36c0bLU, 0x90898ad0LU, 0x93906f4eLU, 0x96bb0da1LU, 0x95a2e83fLU, 0x9cedc932LU, 0x9ff42cacLU, 0x9adf4e43LU, 0x99c6abddLU, 0x88410c59LU, 0x8b58e9c7LU, 0x8e738b28LU, 0x8d6a6eb6LU, 0x84254fbbLU, 0x873caa25LU, 0x8217c8caLU, 0x810e2d54LU, 0xcd0b9262LU, 0xce1277fcLU, 0xcb391513LU, 0xc820f08dLU, 0xc16fd180LU, 0xc276341eLU, 0xc75d56f1LU, 0xc444b36fLU, 0xd5c314ebLU, 0xd6daf175LU, 0xd3f1939aLU, 0xd0e87604LU, 0xd9a75709LU, 0xdabeb297LU, 0xdf95d078LU, 0xdc8c35e6LU, 0xfdd6d33dLU, 0xfecf36a3LU, 0xfbe4544cLU, 0xf8fdb1d2LU, 0xf1b290dfLU, 0xf2ab7541LU, 0xf78017aeLU, 0xf499f230LU, 0xe51e55b4LU, 0xe607b02aLU, 0xe32cd2c5LU, 0xe035375bLU, 0xe97a1656LU, 0xea63f3c8LU, 0xef489127LU, 0xec5174b9LU, 0xadfc10dcLU, 0xaee5f542LU, 0xabce97adLU, 0xa8d77233LU, 0xa198533eLU, 0xa281b6a0LU, 0xa7aad44fLU, 0xa4b331d1LU, 0xb5349655LU, 0xb62d73cbLU, 0xb3061124LU, 0xb01ff4baLU, 0xb950d5b7LU, 0xba493029LU, 0xbf6252c6LU, 0xbc7bb758LU, 0x9d215183LU, 0x9e38b41dLU, 0x9b13d6f2LU, 0x980a336cLU, 0x91451261LU, 0x925cf7ffLU, 0x97779510LU, 0x946e708eLU, 0x85e9d70aLU, 0x86f03294LU, 0x83db507bLU, 0x80c2b5e5LU, 0x898d94e8LU, 0x8a947176LU, 0x8fbf1399LU, 0x8ca6f607LU, 0x0da8db53LU, 0x0eb13ecdLU, 0x0b9a5c22LU, 0x0883b9bcLU, 0x01cc98b1LU, 0x02d57d2fLU, 0x07fe1fc0LU, 0x04e7fa5eLU, 0x15605ddaLU, 0x1679b844LU, 0x1352daabLU, 0x104b3f35LU, 0x19041e38LU, 0x1a1dfba6LU, 0x1f369949LU, 0x1c2f7cd7LU, 0x3d759a0cLU, 0x3e6c7f92LU, 0x3b471d7dLU, 0x385ef8e3LU, 0x3111d9eeLU, 0x32083c70LU, 0x37235e9fLU, 0x343abb01LU, 0x25bd1c85LU, 0x26a4f91bLU, 0x238f9bf4LU, 0x20967e6aLU, 0x29d95f67LU, 0x2ac0baf9LU, 0x2febd816LU, 0x2cf23d88LU, 0x6d5f59edLU, 0x6e46bc73LU, 0x6b6dde9cLU, 0x68743b02LU, 0x613b1a0fLU, 0x6222ff91LU, 0x67099d7eLU, 0x641078e0LU, 0x7597df64LU, 0x768e3afaLU, 0x73a55815LU, 0x70bcbd8bLU, 0x79f39c86LU, 0x7aea7918LU, 0x7fc11bf7LU, 0x7cd8fe69LU, 0x5d8218b2LU, 0x5e9bfd2cLU, 0x5bb09fc3LU, 0x58a97a5dLU, 0x51e65b50LU, 0x52ffbeceLU, 0x57d4dc21LU, 0x54cd39bfLU, 0x454a9e3bLU, 0x46537ba5LU, 0x4378194aLU, 0x4061fcd4LU, 0x492eddd9LU, 0x4a373847LU, 0x4f1c5aa8LU, 0x4c05bf36LU }; #endif /* LTC_TWOFISH_ALL_TABLES */ #endif /* $Source$ */ /* $Revision$ */ /* $Date$ */
the_stack_data/534306.c
#include <unistd.h> #include <errno.h> #include <sys/stat.h> #include "syscall.h" int ttyname_r(int fd, char *name, size_t size) { struct stat st1, st2; char procname[sizeof "/proc/self/fd/" + 3*sizeof(int) + 2]; ssize_t l; if (!isatty(fd)) return errno; __procfdname(procname, fd); l = readlink(procname, name, size); if (l < 0) return errno; else if (l == size) return ERANGE; name[l] = 0; if (stat(name, &st1) || fstat(fd, &st2)) return errno; if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) return ENODEV; return 0; }
the_stack_data/193894159.c
#include <stdarg.h> #include <stdio.h> #include <unistd.h> unsigned long cnt = 0x1122334455667788; void procmsg(const char* format, ...) { va_list ap; fprintf(stdout, "[%d] ", getpid()); va_start(ap, format); vfprintf(stdout, format, ap); va_end(ap); } void advance() { procmsg("after advance, cnt = %#lx.\n", ++cnt); } int main() { procmsg("initial cnt = %#lx.\n", cnt); for (int i = 0; i < 4; ++i) { advance(); } procmsg("main will return.\n"); return 0; }
the_stack_data/1244454.c
#define _GNU_SOURCE #include <stdio.h> #include <errno.h> #include <string.h> #include <stdarg.h> #include <stdlib.h> #include <ctype.h> #include <fcntl.h> #include <dirent.h> #include <unistd.h> #include <time.h> #include <getopt.h> #include <libgen.h> #include <sys/types.h> #include <sys/stat.h> #define MINORBITS 8 #define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi)) /* These are all stolen from busybox's libbb to make * error handling simpler (and since I maintain busybox, * I'm rather partial to these for error handling). * -Erik */ static const char *const app_name = "makedevs"; static const char *const memory_exhausted = "memory exhausted"; static char default_rootdir[]="."; static char *rootdir = default_rootdir; static void verror_msg(const char *s, va_list p) { fflush(stdout); fprintf(stderr, "%s: ", app_name); vfprintf(stderr, s, p); } static void error_msg_and_die(const char *s, ...) { va_list p; va_start(p, s); verror_msg(s, p); va_end(p); putc('\n', stderr); exit(EXIT_FAILURE); } static void vperror_msg(const char *s, va_list p) { int err = errno; if (s == 0) s = ""; verror_msg(s, p); if (*s) s = ": "; fprintf(stderr, "%s%s\n", s, strerror(err)); } #if 0 static void perror_msg(const char *s, ...) { va_list p; va_start(p, s); vperror_msg(s, p); va_end(p); } #endif static void perror_msg_and_die(const char *s, ...) { va_list p; va_start(p, s); vperror_msg(s, p); va_end(p); exit(EXIT_FAILURE); } static FILE *xfopen(const char *path, const char *mode) { FILE *fp; if ((fp = fopen(path, mode)) == NULL) perror_msg_and_die("%s", path); return fp; } static char *xstrdup(const char *s) { char *t; if (s == NULL) return NULL; t = strdup(s); if (t == NULL) error_msg_and_die(memory_exhausted); return t; } static void add_new_directory(char *name, char *path, unsigned long uid, unsigned long gid, unsigned long mode) { mkdir(path, mode); chown(path, uid, gid); // printf("Directory: %s %s UID: %ld GID %ld MODE: %ld\n", path, name, uid, gid, mode); } static void add_new_device(char *name, char *path, unsigned long uid, unsigned long gid, unsigned long mode, dev_t rdev) { int status; struct stat sb; time_t timestamp = time(NULL); memset(&sb, 0, sizeof(struct stat)); status = lstat(path, &sb); if (status >= 0) { /* It is ok for some types of files to not exit on disk (such as * device nodes), but if they _do_ exist the specified mode had * better match the actual file or strange things will happen.... */ if ((mode & S_IFMT) != (sb.st_mode & S_IFMT)) error_msg_and_die("%s: file type does not match specified type!", path); timestamp = sb.st_mtime; } mknod(name, mode, rdev); chown(path, uid, gid); // printf("Device: %s %s UID: %ld GID: %ld MODE: %ld MAJOR: %d MINOR: %d\n", // path, name, uid, gid, mode, (short)(rdev >> 8), (short)(rdev & 0xff)); } static void add_new_file(char *name, char *path, unsigned long uid, unsigned long gid, unsigned long mode) { int fd = open(path,O_CREAT | O_WRONLY, mode); if (fd < 0) { error_msg_and_die("%s: file can not be created!", path); } else { close(fd); } chmod(path, mode); chown(path, uid, gid); // printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n", // path, name, gid, uid, mode); } static void add_new_fifo(char *name, char *path, unsigned long uid, unsigned long gid, unsigned long mode) { if (mknod(path, mode, 0)) error_msg_and_die("%s: file can not be created with mknod!", path); chown(path, uid, gid); // printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n", // path, name, gid, uid, mode); } /* device table entries take the form of: <path> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count> /dev/mem c 640 0 0 1 1 0 0 - type can be one of: f A regular file d Directory c Character special device file b Block special device file p Fifo (named pipe) I don't bother with symlinks (permissions are irrelevant), hard links (special cases of regular files), or sockets (why bother). Regular files must exist in the target root directory. If a char, block, fifo, or directory does not exist, it will be created. count can be prepended with an 'h' to indicate the numbers to append must be hex. I.e. if start, inc and count are 0,1,h12 respectively the devices will be appended with 0,1,2....9,a,b and not 0,1,2....9,10,11 which is the case if 'h' is omitted */ static int interpret_table_entry(char *line) { char *name; char path[4096], type; unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0; unsigned long start = 0, increment = 1, count = 0; char countstr[20+1]; char*pcountstr = countstr; int do_hex = 0; if (0 > sscanf(line, "%40s %c %lo %lu %lu %lu %lu %lu %lu %20s", path, &type, &mode, &uid, &gid, &major, &minor, &start, &increment, countstr)) { return 1; } if (countstr[0] == 'h') { pcountstr++; do_hex = 1; } sscanf(pcountstr,"%lu", &count); if (!strcmp(path, "/")) { error_msg_and_die("Device table entries require absolute paths"); } name = xstrdup(path + 1); sprintf(path, "%s/%s\0", rootdir, name); switch (type) { case 'd': mode |= S_IFDIR; add_new_directory(name, path, uid, gid, mode); break; case 'f': mode |= S_IFREG; add_new_file(name, path, uid, gid, mode); break; case 'p': mode |= S_IFIFO; add_new_fifo(name, path, uid, gid, mode); break; case 'c': case 'b': mode |= (type == 'c') ? S_IFCHR : S_IFBLK; if (count > 0) { int i; dev_t rdev; char buf[80]; for (i = start; i < count; i++) { if (do_hex) { sprintf(buf, "%s%x", name, i); } else { sprintf(buf, "%s%d", name, i); } /* FIXME: MKDEV uses illicit insider knowledge of kernel * major/minor representation... */ rdev = MKDEV(major, minor + (i * increment - start)); add_new_device(buf, path, uid, gid, mode, rdev); } } else { /* FIXME: MKDEV uses illicit insider knowledge of kernel * major/minor representation... */ dev_t rdev = MKDEV(major, minor); add_new_device(name, path, uid, gid, mode, rdev); } break; default: error_msg_and_die("Unsupported file type"); } if (name) free(name); return 0; } static void parse_device_table(FILE * file) { char *line; size_t length = 256; int len = 0; /* Looks ok so far. The general plan now is to read in one * line at a time, check for leading comment delimiters ('#'), * then try and parse the line as a device table. If we fail * to parse things, try and help the poor fool to fix their * device table with a useful error msg... */ if((line = (char *)malloc(length)) == NULL) { fclose(file); return; } while ((len = getline(&line, &length, file)) != -1) { /* First trim off any whitespace */ /* trim trailing whitespace */ while (len > 0 && isspace(line[len - 1])) line[--len] = '\0'; /* trim leading whitespace */ memmove(line, &line[strspn(line, " \n\r\t\v")], len + 1); /* If this is NOT a comment line, try to interpret it */ if (*line != '#') interpret_table_entry(line); } if (line) free(line); fclose(file); } static int go(char *dname, FILE * devtable) { struct stat sb; if (lstat(dname, &sb)) { perror_msg_and_die("%s", dname); } if (chdir(dname)) perror_msg_and_die("%s", dname); if (devtable) parse_device_table(devtable); return 0; } static struct option long_options[] = { {"root", 1, NULL, 'r'}, {"help", 0, NULL, 'h'}, {"squash", 0, NULL, 'q'}, {"version", 0, NULL, 'v'}, {"devtable", 1, NULL, 'D'}, {NULL, 0, NULL, 0} }; static char *helptext = "Usage: makedevs [OPTIONS]\n" "Build entries based upon device_table.txt\n\n" "Options:\n" " -r, -d, --root=DIR Build filesystem from directory DIR (default: cwd)\n" " -D, --devtable=FILE Use the named FILE as a device table file\n" " -q, --squash Squash permissions and owners making all files be owned by root\n" " -h, --help Display this help text\n" " -v, --version Display version information\n\n"; static char *revtext = "$Revision: 0.1 $"; int main(int argc, char **argv) { int c, opt; extern char *optarg; struct stat statbuf; FILE *devtable = NULL; umask (0); while ((opt = getopt_long(argc, argv, "D:d:r:qhv", long_options, &c)) >= 0) { switch (opt) { case 'D': devtable = xfopen(optarg, "r"); if (fstat(fileno(devtable), &statbuf) < 0) perror_msg_and_die(optarg); if (statbuf.st_size < 10) error_msg_and_die("%s: not a proper device table file", optarg); break; case 'h': fprintf(stderr, helptext); exit(1); case 'r': case 'd': /* for compatibility with mkfs.jffs, genext2fs, etc... */ if (rootdir != default_rootdir) { error_msg_and_die("root directory specified more than once"); } rootdir = xstrdup(optarg); break; case 'v': fprintf(stderr, "makedevs revision %.*s\n", (int) strlen(revtext) - 13, revtext + 11); exit(1); } } go(rootdir, devtable); return 0; }
the_stack_data/4652.c
#include <stdio.h> #include <string.h> #include <ctype.h> #ifdef __STDC__ #include <stdlib.h> #endif #define DATE "20 Feb 1996" #define VERSION "2.2" /* chkfont By Glenn Chappell <[email protected]> This program checks figlet 2.0/2.1 font files for format errors. It also looks for signs of common problems and gives warnings. chkfont does not modify font files. Usage: chkfont fontfile ... Note: This is very much a spare-time project. It's probably full o' bugs .... */ /* #define CHECKBLANKS */ #define FONTFILESUFFIX ".flf" #define FONTFILEMAGICNUMBER "flf2" char posshardblanks[9] = { '!', '@', '#', '$', '%', '&', '*', 0x7f, 0 }; char *myname,*fontfilename; FILE *fontfile; char hardblank; int charheight,upheight,maxlen=0,old_layout; int spectagcnt; char *fileline; int maxlinelength=0,currline; int ec,wc; int incon_endmarkwarn,endmark_countwarn,nonincrwarn; int bigcodetagwarn,deutschcodetagwarn,asciicodetagwarn; int codetagcnt; int gone; void weregone(really) int really; { if (!really && 2*ec+wc<=40) { return; } if (ec+wc>0) printf("*******************************************************************************\n"); if (!really) { printf("%s: Too many errors/warnings.\n",fontfilename); } printf("%s: Errors: %d, Warnings: %d\n",fontfilename,ec,wc); if (currline>1 && maxlen!=maxlinelength) { printf("%s: maxlen: %d, actual max line length: %d\n", fontfilename,maxlen,maxlinelength); if (codetagcnt>0 && spectagcnt==-1) { printf("%s: Code-tagged characters: %d\n",fontfilename,codetagcnt); } } printf("-------------------------------------------------------------------------------\n"); gone=1; } char *my_alloc(size) int size; { char *ptr; ptr=(char *)malloc(size); if (ptr==NULL) { fprintf(stderr,"%s: Out of memory\n",myname); exit(1); } return(ptr); } int badsuffix(path,suffix) char *path; char *suffix; { char ucsuffix[10]; char *s; strcpy(ucsuffix,suffix); for (s = ucsuffix; *s; s++) { *s = toupper(*s); } if (strlen(path)<strlen(suffix)) return 1; s = path + strlen(path) - strlen(suffix); if (strcmp(s,suffix) == 0) return 0; if (strcmp(s,ucsuffix) == 0) return 0; return 1; } void usageerr() { fprintf(stderr,"chkfont by Glenn Chappell <[email protected]>\n"); fprintf(stderr,"Version: %s, date: %s\n",VERSION,DATE); fprintf(stderr,"Checks figlet 2.0/2.1 font files for format errors.\n"); fprintf(stderr,"(Does not modify font files.)\n"); fprintf(stderr,"Usage: %s fontfile ...\n",myname); exit(1); } void readchar() { int i,expected_width,k,len,newlen,diff,l; char endmark,expected_endmark; int leadblanks,minleadblanks,trailblanks,mintrailblanks; char *ret; expected_width = expected_endmark = 0; /* prevent compiler warning */ for (i=0;i<charheight;i++) { ret = fgets(fileline,maxlen+1000,fontfile); if (ret == NULL) { printf("%s: ERROR (fatal)- Unexpected read error after line %d.\n", fontfilename,currline); ec++; weregone(1); if (gone) return; } if (feof(fontfile)) { printf("%s: ERROR (fatal)- Unexpected end of file after line %d.\n", fontfilename,currline); ec++; weregone(1); if (gone) return; } currline++; len=strlen(fileline)-1; if (len>maxlinelength) { maxlinelength=len; } if (len>maxlen) { printf("%s: ERROR- Line length > maxlen in line %d.\n", fontfilename,currline); ec++; weregone(0); if (gone) return; } k=len; endmark=k<0?'\0':(k==0||fileline[k]!='\n')?fileline[k]:fileline[k-1]; for(;k>=0?(fileline[k]=='\n' || fileline[k]==endmark):0;k--) { fileline[k]='\0'; } newlen=strlen(fileline); for (l=0;l<newlen ? fileline[l]==' ' : 0;l++) ; leadblanks = l; for (l=newlen-1;l>=0 ? fileline[l]==' ' : 0;l--) ; trailblanks = newlen-1-l; if (i==0) { expected_endmark = endmark; expected_width = newlen; minleadblanks = leadblanks; mintrailblanks = trailblanks; if (endmark==' ') { printf("%s: Warning- Blank endmark in line %d.\n", fontfilename,currline); wc++; weregone(0); if (gone) return; } } else { if (leadblanks<minleadblanks) minleadblanks = leadblanks; if (trailblanks<mintrailblanks) mintrailblanks = trailblanks; if (endmark!=expected_endmark && !incon_endmarkwarn) { printf("%s: Warning- Inconsistent endmark in line %d.\n", fontfilename,currline); printf("%s: (Above warning will only be printed once.)\n", fontfilename); incon_endmarkwarn = 1; wc++; weregone(0); if (gone) return; } if (newlen!=expected_width) { printf("%s: ERROR- Inconsistent character width in line %d.\n", fontfilename,currline); ec++; weregone(0); if (gone) return; } } diff=len-newlen; if (diff>2) { printf("%s: ERROR- Too many endmarks in line %d.\n", fontfilename,currline); ec++; weregone(0); if (gone) return; } else if (charheight>1 && (diff!=(i==charheight-1)+1)) { if (!endmark_countwarn) { printf("%s: Warning- Endchar count convention violated in line %d.\n", fontfilename,currline); printf("%s: (Above warning will only be printed once.)\n", fontfilename); endmark_countwarn = 1; wc++; weregone(0); if (gone) return; } } } #ifdef CHECKBLANKS if (minleadblanks+mintrailblanks>0 && old_layout>=0) { printf("%s: Warning- Leading/trailing blanks in char. ending at line %d.\n", fontfilename,currline); printf("%s: (Above warning only given when old_layout > -1.)\n", fontfilename); wc++; weregone(0); if (gone) return; } #endif /* #ifdef CHECKBLANKS */ } void checkit() { int i,k,cmtcount,numsread,ffrighttoleft,have_layout,layout; char magicnum[5],cha; long oldord,theord; int tmpcnt,len; ec=0;wc=0; incon_endmarkwarn=0; endmark_countwarn=0; nonincrwarn=0; bigcodetagwarn=0; deutschcodetagwarn=0; asciicodetagwarn=0; codetagcnt=0; gone=0; if (!strcmp(fontfilename,"-")) { fontfilename="(stdin)"; fontfile=stdin; } else { fontfile=fopen(fontfilename,"r"); if (fontfile == NULL) { fprintf(stderr,"%s: Could not open file '%s'\n",myname,fontfilename); exit(1); } } if (fontfile!=stdin) { if (badsuffix(fontfilename,FONTFILESUFFIX)) { printf("%s: ERROR- Filename does not end with '%s'.\n", fontfilename,FONTFILESUFFIX); ec++; weregone(0); if (gone) return; } } numsread=fscanf(fontfile,"%4s",magicnum); if (numsread == EOF) { printf("%s: ERROR- can't read magic number.\n",fontfilename); ec++; weregone(0); if (gone) return; } if (strcmp(magicnum,FONTFILEMAGICNUMBER)) { printf("%s: ERROR- Incorrect magic number.\n",fontfilename); ec++; weregone(0); if (gone) return; } cha=getc(fontfile); if (cha!='a') { printf("%s: Warning- Sub-version character is not 'a'.\n",fontfilename); wc++; weregone(0); if (gone) return; } fileline=(char*)my_alloc(sizeof(char)*(1001)); if (fgets(fileline,1001,fontfile)==NULL) { fileline[0] = '\0'; } if (strlen(fileline)>0 ? fileline[strlen(fileline)-1]!='\n' : 0) { while(k=getc(fontfile),k!='\n'&&k!=EOF) ; /* Advance to end of line */ } numsread=sscanf(fileline,"%c %d %d %d %d %d %d %d %d", &hardblank,&charheight,&upheight,&maxlen,&old_layout,&cmtcount, &ffrighttoleft,&layout,&spectagcnt); free(fileline); fileline = NULL; if (numsread<7) { ffrighttoleft=0; } if (numsread<9) { spectagcnt=-1; } have_layout = (numsread>=8); if (6>numsread) { printf("%s: ERROR (fatal)- First line improperly formatted.\n",fontfilename); ec++; weregone(1); if (gone) return; } if (!strchr(posshardblanks,hardblank)) { printf("%s: Warning- Unusual hardblank.\n",fontfilename); wc++; weregone(0); if (gone) return; } if (charheight<1) { printf("%s: ERROR (fatal)- charheight not positive.\n",fontfilename); ec++; weregone(1); if (gone) return; } if (upheight>charheight || upheight<1) { printf("%s: ERROR- up_height out of bounds.\n",fontfilename); ec++; weregone(0); if (gone) return; } if (maxlen<1) { printf("%s: ERROR (fatal)- maxlen not positive.\n",fontfilename); ec++; weregone(1); if (gone) return; } if (old_layout<-1) { printf("%s: ERROR- old_layout < -1.\n",fontfilename); ec++; weregone(0); if (gone) return; } if (old_layout>63) { printf("%s: ERROR- old_layout > 63.\n",fontfilename); ec++; weregone(0); if (gone) return; } if (have_layout && layout<0) { printf("%s: ERROR- layout < 0.\n", fontfilename); ec++; weregone(0); if (gone) return; } if (have_layout &&layout>32767) { printf("%s: ERROR- layout > 32767.\n", fontfilename); ec++; weregone(0); if (gone) return; } if (have_layout && old_layout == -1 && (layout & 192)) { printf("%s: ERROR- layout %d is inconsistent with old_layout -1.\n", fontfilename,layout); ec++; weregone(0); if (gone) return; } if (have_layout && old_layout == 0 && (layout & 192) != 64 && (layout & 255) != 128) { printf("%s: ERROR- layout %d is inconsistent with old_layout 0.\n", fontfilename,layout); ec++; weregone(0); if (gone) return; } if (have_layout && old_layout > 0 && (!(layout & 128) || old_layout != (layout & 63))) { printf("%s: ERROR- layout %d is inconsistent with old_layout %d.\n", fontfilename,layout,old_layout); ec++; weregone(0); if (gone) return; } if (cmtcount<0) { printf("%s: ERROR- cmt_count is negative.\n",fontfilename); ec++; weregone(0); if (gone) return; } if (ffrighttoleft<0 || ffrighttoleft>1) { printf("%s: ERROR- rtol out of bounds.\n",fontfilename); ec++; weregone(0); if (gone) return; } for (i=1;i<=cmtcount;i++) { while(k=getc(fontfile),k!='\n'&&k!=EOF) ; /* Advance to end of line */ } maxlinelength = 0; currline=cmtcount+1; fileline=(char*)my_alloc(sizeof(char)*(maxlen+1001)); for (i=0;i<102;i++) { readchar(); if (gone) return; } oldord=0; while(fgets(fileline,maxlen+1000,fontfile)!=NULL) { currline++; len=strlen(fileline)-1; if (len-100>maxlinelength) { maxlinelength=len-100; } if (len>maxlen+100) { printf("%s: ERROR- Code tag line way too long in line %d.\n", fontfilename,currline); ec++; weregone(0); if (gone) return; } tmpcnt=sscanf(fileline,"%li",&theord); if (tmpcnt<1) { printf("%s: Warning- Extra chars after font in line %d.\n", fontfilename,currline); wc++; weregone(0); if (gone) return; break; } codetagcnt++; if (theord>65535 && !bigcodetagwarn) { printf("%s: Warning- Code tag > 65535 in line %d.\n", fontfilename,currline); printf("%s: (Above warning will only be printed once.)\n", fontfilename); bigcodetagwarn = 1; wc++; weregone(0); if (gone) return; } if (theord==-1) { printf("%s: ERROR- Code tag -1 (unusable) in line %d.\n", fontfilename,currline); ec++; weregone(0); if (gone) return; break; } if (theord>=-255 && theord<=-249 &&!deutschcodetagwarn) { printf("%s: Warning- Code tag in old Deutsch area in line %d.\n", fontfilename,currline); printf("%s: (Above warning will only be printed once.)\n", fontfilename); deutschcodetagwarn = 1; wc++; weregone(0); if (gone) return; } if (theord<127 && theord>31 && !asciicodetagwarn) { printf("%s: Warning- Code tag in ASCII range in line %d.\n", fontfilename,currline); printf("%s: (Above warning will only be printed once.)\n", fontfilename); asciicodetagwarn = 1; wc++; weregone(0); if (gone) return; } else if (theord<=oldord && theord>=0 && oldord>=0 && !nonincrwarn) { printf("%s: Warning- Non-increasing code tag in line %d.\n", fontfilename,currline); printf("%s: (Above warning will only be printed once.)\n", fontfilename); nonincrwarn = 1; wc++; weregone(0); if (gone) return; } oldord=theord; readchar(); if (gone) return; } if (spectagcnt!=-1 && spectagcnt!=codetagcnt) { printf("%s: ERROR- Inconsistent Codetag_Cnt value %d\n", fontfilename, spectagcnt); ec++; weregone(0); if (gone) return; } if (fontfile!=stdin) fclose(fontfile); weregone(1); if (gone) return; } int main(argc,argv) int argc; char *argv[]; { int arg; if ((myname=strrchr(argv[0],'/'))!=NULL) { myname++; } else { myname = argv[0]; } if (argc<2) { usageerr(); } for (arg=1;arg<argc;arg++) { fontfilename=argv[arg]; fileline=NULL; checkit(); if (fileline!=NULL) free(fileline); } return 0; }
the_stack_data/42591.c
#include<stdio.h> int main() { int a[100][100],i,j,k,inum,n,flag=0,flag2=0; scanf("%d",&inum); for(i=0; i<inum; i++) { scanf("%d",&n); for(j=0; j<n; j++) for(k=0; k<n; k++) scanf("%d",&a[j][k]); for(j=0; j<n/2; j++) { for(k=0; k<n; k++) if(a[j][k]!=a[n-1-j][k]) { flag=1; break; } if(flag==1) { break; } } for(j=0; j<n; j++) { for(k=0; k<n/2; k++) if(a[j][k]!=a[j][n-1-k]) { flag2=1; break; } if(flag2==1) break;} if(flag!=1&&flag2!=1) printf("yes\n"); else printf("no\n"); flag=0; flag2=0; } return 0; }
the_stack_data/84419.c
//call a function with no argument void apple(int an_array[]) { return; } void main(void) { int an_array[10]; apple(an_array); return; }
the_stack_data/85791.c
/* miniz.c v1.15 - public domain deflate/inflate, zlib-subset, ZIP reading/writing/appending, PNG writing See "unlicense" statement at the end of this file. Rich Geldreich <[email protected]>, last updated Oct. 13, 2013 Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: http://www.ietf.org/rfc/rfc1951.txt Most API's defined in miniz.c are optional. For example, to disable the archive related functions just define MINIZ_NO_ARCHIVE_APIS, or to get rid of all stdio usage define MINIZ_NO_STDIO (see the list below for more macros). * Change History 10/13/13 v1.15 r4 - Interim bugfix release while I work on the next major release with Zip64 support (almost there!): - Critical fix for the MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY bug (thanks [email protected]) which could cause locate files to not find files. This bug would only have occured in earlier versions if you explicitly used this flag, OR if you used mz_zip_extract_archive_file_to_heap() or mz_zip_add_mem_to_archive_file_in_place() (which used this flag). If you can't switch to v1.15 but want to fix this bug, just remove the uses of this flag from both helper funcs (and of course don't use the flag). - Bugfix in mz_zip_reader_extract_to_mem_no_alloc() from kymoon when pUser_read_buf is not NULL and compressed size is > uncompressed size - Fixing mz_zip_reader_extract_*() funcs so they don't try to extract compressed data from directory entries, to account for weird zipfiles which contain zero-size compressed data on dir entries. Hopefully this fix won't cause any issues on weird zip archives, because it assumes the low 16-bits of zip external attributes are DOS attributes (which I believe they always are in practice). - Fixing mz_zip_reader_is_file_a_directory() so it doesn't check the internal attributes, just the filename and external attributes - mz_zip_reader_init_file() - missing MZ_FCLOSE() call if the seek failed - Added cmake support for Linux builds which builds all the examples, tested with clang v3.3 and gcc v4.6. - Clang fix for tdefl_write_image_to_png_file_in_memory() from toffaletti - Merged MZ_FORCEINLINE fix from hdeanclark - Fix <time.h> include before config #ifdef, thanks emil.brink - Added tdefl_write_image_to_png_file_in_memory_ex(): supports Y flipping (super useful for OpenGL apps), and explicit control over the compression level (so you can set it to 1 for real-time compression). - Merged in some compiler fixes from paulharris's github repro. - Retested this build under Windows (VS 2010, including static analysis), tcc 0.9.26, gcc v4.6 and clang v3.3. - Added example6.c, which dumps an image of the mandelbrot set to a PNG file. - Modified example2 to help test the MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY flag more. - In r3: Bugfix to mz_zip_writer_add_file() found during merge: Fix possible src file fclose() leak if alignment bytes+local header file write faiiled - In r4: Minor bugfix to mz_zip_writer_add_from_zip_reader(): Was pushing the wrong central dir header offset, appears harmless in this release, but it became a problem in the zip64 branch 5/20/12 v1.14 - MinGW32/64 GCC 4.6.1 compiler fixes: added MZ_FORCEINLINE, #include <time.h> (thanks fermtect). 5/19/12 v1.13 - From [email protected] and [email protected] - Fix mz_crc32() so it doesn't compute the wrong CRC-32's when mz_ulong is 64-bit. - Temporarily/locally slammed in "typedef unsigned long mz_ulong" and re-ran a randomized regression test on ~500k files. - Eliminated a bunch of warnings when compiling with GCC 32-bit/64. - Ran all examples, miniz.c, and tinfl.c through MSVC 2008's /analyze (static analysis) option and fixed all warnings (except for the silly "Use of the comma-operator in a tested expression.." analysis warning, which I purposely use to work around a MSVC compiler warning). - Created 32-bit and 64-bit Codeblocks projects/workspace. Built and tested Linux executables. The codeblocks workspace is compatible with Linux+Win32/x64. - Added miniz_tester solution/project, which is a useful little app derived from LZHAM's tester app that I use as part of the regression test. - Ran miniz.c and tinfl.c through another series of regression testing on ~500,000 files and archives. - Modified example5.c so it purposely disables a bunch of high-level functionality (MINIZ_NO_STDIO, etc.). (Thanks to corysama for the MINIZ_NO_STDIO bug report.) - Fix ftell() usage in examples so they exit with an error on files which are too large (a limitation of the examples, not miniz itself). 4/12/12 v1.12 - More comments, added low-level example5.c, fixed a couple minor level_and_flags issues in the archive API's. level_and_flags can now be set to MZ_DEFAULT_COMPRESSION. Thanks to Bruce Dawson <[email protected]> for the feedback/bug report. 5/28/11 v1.11 - Added statement from unlicense.org 5/27/11 v1.10 - Substantial compressor optimizations: - Level 1 is now ~4x faster than before. The L1 compressor's throughput now varies between 70-110MB/sec. on a - Core i7 (actual throughput varies depending on the type of data, and x64 vs. x86). - Improved baseline L2-L9 compression perf. Also, greatly improved compression perf. issues on some file types. - Refactored the compression code for better readability and maintainability. - Added level 10 compression level (L10 has slightly better ratio than level 9, but could have a potentially large drop in throughput on some files). 5/15/11 v1.09 - Initial stable release. * Low-level Deflate/Inflate implementation notes: Compression: Use the "tdefl" API's. The compressor supports raw, static, and dynamic blocks, lazy or greedy parsing, match length filtering, RLE-only, and Huffman-only streams. It performs and compresses approximately as well as zlib. Decompression: Use the "tinfl" API's. The entire decompressor is implemented as a single function coroutine: see tinfl_decompress(). It supports decompression into a 32KB (or larger power of 2) wrapping buffer, or into a memory block large enough to hold the entire file. The low-level tdefl/tinfl API's do not make any use of dynamic memory allocation. * zlib-style API notes: miniz.c implements a fairly large subset of zlib. There's enough functionality present for it to be a drop-in zlib replacement in many apps: The z_stream struct, optional memory allocation callbacks deflateInit/deflateInit2/deflate/deflateReset/deflateEnd/deflateBound inflateInit/inflateInit2/inflate/inflateEnd compress, compress2, compressBound, uncompress CRC-32, Adler-32 - Using modern, minimal code size, CPU cache friendly routines. Supports raw deflate streams or standard zlib streams with adler-32 checking. Limitations: The callback API's are not implemented yet. No support for gzip headers or zlib static dictionaries. I've tried to closely emulate zlib's various flavors of stream flushing and return status codes, but there are no guarantees that miniz.c pulls this off perfectly. * PNG writing: See the tdefl_write_image_to_png_file_in_memory() function, originally written by Alex Evans. Supports 1-4 bytes/pixel images. * ZIP archive API notes: The ZIP archive API's where designed with simplicity and efficiency in mind, with just enough abstraction to get the job done with minimal fuss. There are simple API's to retrieve file information, read files from existing archives, create new archives, append new files to existing archives, or clone archive data from one archive to another. It supports archives located in memory or the heap, on disk (using stdio.h), or you can specify custom file read/write callbacks. - Archive reading: Just call this function to read a single file from a disk archive: void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint zip_flags); For more complex cases, use the "mz_zip_reader" functions. Upon opening an archive, the entire central directory is located and read as-is into memory, and subsequent file access only occurs when reading individual files. - Archives file scanning: The simple way is to use this function to scan a loaded archive for a specific file: int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags); The locate operation can optionally check file comments too, which (as one example) can be used to identify multiple versions of the same file in an archive. This function uses a simple linear search through the central directory, so it's not very fast. Alternately, you can iterate through all the files in an archive (using mz_zip_reader_get_num_files()) and retrieve detailed info on each file by calling mz_zip_reader_file_stat(). - Archive creation: Use the "mz_zip_writer" functions. The ZIP writer immediately writes compressed file data to disk and builds an exact image of the central directory in memory. The central directory image is written all at once at the end of the archive file when the archive is finalized. The archive writer can optionally align each file's local header and file data to any power of 2 alignment, which can be useful when the archive will be read from optical media. Also, the writer supports placing arbitrary data blobs at the very beginning of ZIP archives. Archives written using either feature are still readable by any ZIP tool. - Archive appending: The simple way to add a single file to an archive is to call this function: mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); The archive will be created if it doesn't already exist, otherwise it'll be appended to. Note the appending is done in-place and is not an atomic operation, so if something goes wrong during the operation it's possible the archive could be left without a central directory (although the local file headers and file data will be fine, so the archive will be recoverable). For more complex archive modification scenarios: 1. The safest way is to use a mz_zip_reader to read the existing archive, cloning only those bits you want to preserve into a new archive using using the mz_zip_writer_add_from_zip_reader() function (which compiles the compressed file data as-is). When you're done, delete the old archive and rename the newly written archive, and you're done. This is safe but requires a bunch of temporary disk space or heap memory. 2. Or, you can convert an mz_zip_reader in-place to an mz_zip_writer using mz_zip_writer_init_from_reader(), append new files as needed, then finalize the archive which will write an updated central directory to the original archive. (This is basically what mz_zip_add_mem_to_archive_file_in_place() does.) There's a possibility that the archive's central directory could be lost with this method if anything goes wrong, though. - ZIP archive support limitations: No zip64 or spanning support. Extraction functions can only handle unencrypted, stored or deflated files. Requires streams capable of seeking. * This is a header file library, like stb_image.c. To get only a header file, either cut and paste the below header, or create miniz.h, #define MINIZ_HEADER_FILE_ONLY, and then include miniz.c from it. * Important: For best perf. be sure to customize the below macros for your target platform: #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 #define MINIZ_LITTLE_ENDIAN 1 #define MINIZ_HAS_64BIT_REGISTERS 1 * On platforms using glibc, Be sure to "#define _LARGEFILE64_SOURCE 1" before including miniz.c to ensure miniz uses the 64-bit variants: fopen64(), stat64(), etc. Otherwise you won't be able to process large files (i.e. 32-bit stat() fails for me on files > 0x7FFFFFFF bytes). */ #ifndef MINIZ_HEADER_INCLUDED #define MINIZ_HEADER_INCLUDED #include <stdlib.h> // Defines to completely disable specific portions of miniz.c: // If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. // Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. //#define MINIZ_NO_STDIO // If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or // get/set file times, and the C run-time funcs that get/set times won't be called. // The current downside is the times written to your archives will be from 1979. //#define MINIZ_NO_TIME // Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. //#define MINIZ_NO_ARCHIVE_APIS // Define MINIZ_NO_ARCHIVE_APIS to disable all writing related ZIP archive API's. //#define MINIZ_NO_ARCHIVE_WRITING_APIS // Define MINIZ_NO_ZLIB_APIS to remove all ZLIB-style compression/decompression API's. //#define MINIZ_NO_ZLIB_APIS // Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. //#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES // Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc. // Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc // callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user // functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. //#define MINIZ_NO_MALLOC #if defined(__TINYC__) && (defined(__linux) || defined(__linux__)) // TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux #define MINIZ_NO_TIME #endif #if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS) #include <time.h> #endif #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__) // MINIZ_X86_OR_X64_CPU is only used to help set the below macros. #define MINIZ_X86_OR_X64_CPU 1 #endif #if (__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU // Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. #define MINIZ_LITTLE_ENDIAN 1 #endif #if MINIZ_X86_OR_X64_CPU // Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses. #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 #endif #if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__) // Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions). #define MINIZ_HAS_64BIT_REGISTERS 1 #endif #ifdef __cplusplus extern "C" { #endif // ------------------- zlib-style API Definitions. // For more compatibility with zlib, miniz.c uses unsigned long for some parameters/struct members. Beware: mz_ulong can be either 32 or 64-bits! typedef unsigned long mz_ulong; // mz_free() internally uses the MZ_FREE() macro (which by default calls free() unless you've modified the MZ_MALLOC macro) to release a block allocated from the heap. void mz_free(void *p); #define MZ_ADLER32_INIT (1) // mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL. mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len); #define MZ_CRC32_INIT (0) // mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL. mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len); // Compression strategies. enum { MZ_DEFAULT_STRATEGY = 0, MZ_FILTERED = 1, MZ_HUFFMAN_ONLY = 2, MZ_RLE = 3, MZ_FIXED = 4 }; // Method #define MZ_DEFLATED 8 #ifndef MINIZ_NO_ZLIB_APIS // Heap allocation callbacks. // Note that mz_alloc_func parameter types purpsosely differ from zlib's: items/size is size_t, not unsigned long. typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size); typedef void (*mz_free_func)(void *opaque, void *address); typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size); #define MZ_VERSION "9.1.15" #define MZ_VERNUM 0x91F0 #define MZ_VER_MAJOR 9 #define MZ_VER_MINOR 1 #define MZ_VER_REVISION 15 #define MZ_VER_SUBREVISION 0 // Flush values. For typical usage you only need MZ_NO_FLUSH and MZ_FINISH. The other values are for advanced use (refer to the zlib docs). enum { MZ_NO_FLUSH = 0, MZ_PARTIAL_FLUSH = 1, MZ_SYNC_FLUSH = 2, MZ_FULL_FLUSH = 3, MZ_FINISH = 4, MZ_BLOCK = 5 }; // Return status codes. MZ_PARAM_ERROR is non-standard. enum { MZ_OK = 0, MZ_STREAM_END = 1, MZ_NEED_DICT = 2, MZ_ERRNO = -1, MZ_STREAM_ERROR = -2, MZ_DATA_ERROR = -3, MZ_MEM_ERROR = -4, MZ_BUF_ERROR = -5, MZ_VERSION_ERROR = -6, MZ_PARAM_ERROR = -10000 }; // Compression levels: 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow), MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL. enum { MZ_NO_COMPRESSION = 0, MZ_BEST_SPEED = 1, MZ_BEST_COMPRESSION = 9, MZ_UBER_COMPRESSION = 10, MZ_DEFAULT_LEVEL = 6, MZ_DEFAULT_COMPRESSION = -1 }; // Window bits #define MZ_DEFAULT_WINDOW_BITS 15 struct mz_internal_state; // Compression/decompression stream struct. typedef struct mz_stream_s { const unsigned char *next_in; // pointer to next byte to read unsigned int avail_in; // number of bytes available at next_in mz_ulong total_in; // total number of bytes consumed so far unsigned char *next_out; // pointer to next byte to write unsigned int avail_out; // number of bytes that can be written to next_out mz_ulong total_out; // total number of bytes produced so far char *msg; // error msg (unused) struct mz_internal_state *state; // internal state, allocated by zalloc/zfree mz_alloc_func zalloc; // optional heap allocation function (defaults to malloc) mz_free_func zfree; // optional heap free function (defaults to free) void *opaque; // heap alloc function user pointer int data_type; // data_type (unused) mz_ulong adler; // adler32 of the source or uncompressed data mz_ulong reserved; // not used } mz_stream; typedef mz_stream *mz_streamp; // Returns the version string of miniz.c. const char *mz_version(void); // mz_deflateInit() initializes a compressor with default options: // Parameters: // pStream must point to an initialized mz_stream struct. // level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION]. // level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio. // (This special func. is currently only enabled when MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.) // Return values: // MZ_OK on success. // MZ_STREAM_ERROR if the stream is bogus. // MZ_PARAM_ERROR if the input parameters are bogus. // MZ_MEM_ERROR on out of memory. int mz_deflateInit(mz_streamp pStream, int level); // mz_deflateInit2() is like mz_deflate(), except with more control: // Additional parameters: // method must be MZ_DEFLATED // window_bits must be MZ_DEFAULT_WINDOW_BITS (to wrap the deflate stream with zlib header/adler-32 footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate/no header or footer) // mem_level must be between [1, 9] (it's checked but ignored by miniz.c) int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy); // Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2(). int mz_deflateReset(mz_streamp pStream); // mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible. // Parameters: // pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. // flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or MZ_FINISH. // Return values: // MZ_OK on success (when flushing, or if more input is needed but not available, and/or there's more output to be written but the output buffer is full). // MZ_STREAM_END if all input has been consumed and all output bytes have been written. Don't call mz_deflate() on the stream anymore. // MZ_STREAM_ERROR if the stream is bogus. // MZ_PARAM_ERROR if one of the parameters is invalid. // MZ_BUF_ERROR if no forward progress is possible because the input and/or output buffers are empty. (Fill up the input buffer or free up some output space and try again.) int mz_deflate(mz_streamp pStream, int flush); // mz_deflateEnd() deinitializes a compressor: // Return values: // MZ_OK on success. // MZ_STREAM_ERROR if the stream is bogus. int mz_deflateEnd(mz_streamp pStream); // mz_deflateBound() returns a (very) conservative upper bound on the amount of data that could be generated by deflate(), assuming flush is set to only MZ_NO_FLUSH or MZ_FINISH. mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len); // Single-call compression functions mz_compress() and mz_compress2(): // Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure. int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level); // mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). mz_ulong mz_compressBound(mz_ulong source_len); // Initializes a decompressor. int mz_inflateInit(mz_streamp pStream); // mz_inflateInit2() is like mz_inflateInit() with an additional option that controls the window size and whether or not the stream has been wrapped with a zlib header/footer: // window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). int mz_inflateInit2(mz_streamp pStream, int window_bits); // Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible. // Parameters: // pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. // flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH. // On the first call, if flush is MZ_FINISH it's assumed the input and output buffers are both sized large enough to decompress the entire stream in a single call (this is slightly faster). // MZ_FINISH implies that there are no more source bytes available beside what's already in the input buffer, and that the output buffer is large enough to hold the rest of the decompressed data. // Return values: // MZ_OK on success. Either more input is needed but not available, and/or there's more output to be written but the output buffer is full. // MZ_STREAM_END if all needed input has been consumed and all output bytes have been written. For zlib streams, the adler-32 of the decompressed data has also been verified. // MZ_STREAM_ERROR if the stream is bogus. // MZ_DATA_ERROR if the deflate stream is invalid. // MZ_PARAM_ERROR if one of the parameters is invalid. // MZ_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call mz_inflate() again // with more input data, or with more room in the output buffer (except when using single call decompression, described above). int mz_inflate(mz_streamp pStream, int flush); // Deinitializes a decompressor. int mz_inflateEnd(mz_streamp pStream); // Single-call decompression. // Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); // Returns a string description of the specified error code, or NULL if the error code is invalid. const char *mz_error(int err); // Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports. // Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project. #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES typedef unsigned char Byte; typedef unsigned int uInt; typedef mz_ulong uLong; typedef Byte Bytef; typedef uInt uIntf; typedef char charf; typedef int intf; typedef void *voidpf; typedef uLong uLongf; typedef void *voidp; typedef void *const voidpc; #define Z_NULL 0 #define Z_NO_FLUSH MZ_NO_FLUSH #define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH #define Z_SYNC_FLUSH MZ_SYNC_FLUSH #define Z_FULL_FLUSH MZ_FULL_FLUSH #define Z_FINISH MZ_FINISH #define Z_BLOCK MZ_BLOCK #define Z_OK MZ_OK #define Z_STREAM_END MZ_STREAM_END #define Z_NEED_DICT MZ_NEED_DICT #define Z_ERRNO MZ_ERRNO #define Z_STREAM_ERROR MZ_STREAM_ERROR #define Z_DATA_ERROR MZ_DATA_ERROR #define Z_MEM_ERROR MZ_MEM_ERROR #define Z_BUF_ERROR MZ_BUF_ERROR #define Z_VERSION_ERROR MZ_VERSION_ERROR #define Z_PARAM_ERROR MZ_PARAM_ERROR #define Z_NO_COMPRESSION MZ_NO_COMPRESSION #define Z_BEST_SPEED MZ_BEST_SPEED #define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION #define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION #define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY #define Z_FILTERED MZ_FILTERED #define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY #define Z_RLE MZ_RLE #define Z_FIXED MZ_FIXED #define Z_DEFLATED MZ_DEFLATED #define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS #define alloc_func mz_alloc_func #define free_func mz_free_func #define internal_state mz_internal_state #define z_stream mz_stream #define deflateInit mz_deflateInit #define deflateInit2 mz_deflateInit2 #define deflateReset mz_deflateReset #define deflate mz_deflate #define deflateEnd mz_deflateEnd #define deflateBound mz_deflateBound #define compress mz_compress #define compress2 mz_compress2 #define compressBound mz_compressBound #define inflateInit mz_inflateInit #define inflateInit2 mz_inflateInit2 #define inflate mz_inflate #define inflateEnd mz_inflateEnd #define uncompress mz_uncompress #define crc32 mz_crc32 #define adler32 mz_adler32 #define MAX_WBITS 15 #define MAX_MEM_LEVEL 9 #define zError mz_error #define ZLIB_VERSION MZ_VERSION #define ZLIB_VERNUM MZ_VERNUM #define ZLIB_VER_MAJOR MZ_VER_MAJOR #define ZLIB_VER_MINOR MZ_VER_MINOR #define ZLIB_VER_REVISION MZ_VER_REVISION #define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION #define zlibVersion mz_version #define zlib_version mz_version() #endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES #endif // MINIZ_NO_ZLIB_APIS // ------------------- Types and macros typedef unsigned char mz_uint8; typedef signed short mz_int16; typedef unsigned short mz_uint16; typedef unsigned int mz_uint32; typedef unsigned int mz_uint; typedef long long mz_int64; typedef unsigned long long mz_uint64; typedef int mz_bool; #define MZ_FALSE (0) #define MZ_TRUE (1) // An attempt to work around MSVC's spammy "warning C4127: conditional expression is constant" message. #ifdef _MSC_VER #define MZ_MACRO_END while (0, 0) #else #define MZ_MACRO_END while (0) #endif // ------------------- ZIP archive reading/writing #ifndef MINIZ_NO_ARCHIVE_APIS enum { MZ_ZIP_MAX_IO_BUF_SIZE = 64*1024, MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 260, MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 256 }; typedef struct { mz_uint32 m_file_index; mz_uint32 m_central_dir_ofs; mz_uint16 m_version_made_by; mz_uint16 m_version_needed; mz_uint16 m_bit_flag; mz_uint16 m_method; #ifndef MINIZ_NO_TIME time_t m_time; #endif mz_uint32 m_crc32; mz_uint64 m_comp_size; mz_uint64 m_uncomp_size; mz_uint16 m_internal_attr; mz_uint32 m_external_attr; mz_uint64 m_local_header_ofs; mz_uint32 m_comment_size; char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE]; char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE]; } mz_zip_archive_file_stat; typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n); typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n); struct mz_zip_internal_state_tag; typedef struct mz_zip_internal_state_tag mz_zip_internal_state; typedef enum { MZ_ZIP_MODE_INVALID = 0, MZ_ZIP_MODE_READING = 1, MZ_ZIP_MODE_WRITING = 2, MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3 } mz_zip_mode; typedef struct mz_zip_archive_tag { mz_uint64 m_archive_size; mz_uint64 m_central_directory_file_ofs; mz_uint m_total_files; mz_zip_mode m_zip_mode; mz_uint m_file_offset_alignment; mz_alloc_func m_pAlloc; mz_free_func m_pFree; mz_realloc_func m_pRealloc; void *m_pAlloc_opaque; mz_file_read_func m_pRead; mz_file_write_func m_pWrite; void *m_pIO_opaque; mz_zip_internal_state *m_pState; } mz_zip_archive; typedef enum { MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100, MZ_ZIP_FLAG_IGNORE_PATH = 0x0200, MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400, MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY = 0x0800 } mz_zip_flags; // ZIP archive reading // Inits a ZIP archive reader. // These functions read and validate the archive's central directory. mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags); mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags); #ifndef MINIZ_NO_STDIO mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags); #endif // Returns the total number of files in the archive. mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip); // Returns detailed information about an archive file entry. mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat); // Determines if an archive file entry is a directory entry. mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index); mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index); // Retrieves the filename of an archive file entry. // Returns the number of bytes written to pFilename, or if filename_buf_size is 0 this function returns the number of bytes needed to fully store the filename. mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size); // Attempts to locates a file in the archive's central directory. // Valid flags: MZ_ZIP_FLAG_CASE_SENSITIVE, MZ_ZIP_FLAG_IGNORE_PATH // Returns -1 if the file cannot be found. int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags); // Extracts a archive file to a memory buffer using no memory allocation. mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); // Extracts a archive file to a memory buffer. mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags); mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags); // Extracts a archive file to a dynamically allocated heap buffer. void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags); void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags); // Extracts a archive file using a callback function to output the file's data. mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); #ifndef MINIZ_NO_STDIO // Extracts a archive file to a disk file and sets its last accessed and modified times. // This function only extracts files, not archive directory records. mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags); mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags); #endif // Ends archive reading, freeing all allocations, and closing the input archive file if mz_zip_reader_init_file() was used. mz_bool mz_zip_reader_end(mz_zip_archive *pZip); // ZIP archive writing #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS // Inits a ZIP archive writer. mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size); mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size); #ifndef MINIZ_NO_STDIO mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning); #endif // Converts a ZIP archive reader object into a writer object, to allow efficient in-place file appends to occur on an existing archive. // For archives opened using mz_zip_reader_init_file, pFilename must be the archive's filename so it can be reopened for writing. If the file can't be reopened, mz_zip_reader_end() will be called. // For archives opened using mz_zip_reader_init_mem, the memory block must be growable using the realloc callback (which defaults to realloc unless you've overridden it). // Finally, for archives opened using mz_zip_reader_init, the mz_zip_archive's user provided m_pWrite function cannot be NULL. // Note: In-place archive modification is not recommended unless you know what you're doing, because if execution stops or something goes wrong before // the archive is finalized the file's central directory will be hosed. mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename); // Adds the contents of a memory buffer to an archive. These functions record the current local time into the archive. // To add a directory entry, call this method with an archive name ending in a forwardslash with empty buffer. // level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags); mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32); #ifndef MINIZ_NO_STDIO // Adds the contents of a disk file to an archive. This function also records the disk file's modified time into the archive. // level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); #endif // Adds a file to an archive by fully cloning the data from another archive. // This function fully clones the source file's compressed data (no recompression), along with its full filename, extra data, and comment fields. mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint file_index); // Finalizes the archive by writing the central directory records followed by the end of central directory record. // After an archive is finalized, the only valid call on the mz_zip_archive struct is mz_zip_writer_end(). // An archive must be manually finalized by calling this function for it to be valid. mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip); mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, size_t *pSize); // Ends archive writing, freeing all allocations, and closing the output file if mz_zip_writer_init_file() was used. // Note for the archive to be valid, it must have been finalized before ending. mz_bool mz_zip_writer_end(mz_zip_archive *pZip); // Misc. high-level helper functions: // mz_zip_add_mem_to_archive_file_in_place() efficiently (but not atomically) appends a memory blob to a ZIP archive. // level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); // Reads a single file from an archive into a heap block. // Returns NULL on failure. void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint zip_flags); #endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS #endif // #ifndef MINIZ_NO_ARCHIVE_APIS // ------------------- Low-level Decompression API Definitions // Decompression flags used by tinfl_decompress(). // TINFL_FLAG_PARSE_ZLIB_HEADER: If set, the input has a valid zlib header and ends with an adler32 checksum (it's a valid zlib stream). Otherwise, the input is a raw deflate stream. // TINFL_FLAG_HAS_MORE_INPUT: If set, there are more input bytes available beyond the end of the supplied input buffer. If clear, the input buffer contains all remaining input. // TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF: If set, the output buffer is large enough to hold the entire decompressed stream. If clear, the output buffer is at least the size of the dictionary (typically 32KB). // TINFL_FLAG_COMPUTE_ADLER32: Force adler-32 checksum computation of the decompressed bytes. enum { TINFL_FLAG_PARSE_ZLIB_HEADER = 1, TINFL_FLAG_HAS_MORE_INPUT = 2, TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4, TINFL_FLAG_COMPUTE_ADLER32 = 8 }; // High level decompression functions: // tinfl_decompress_mem_to_heap() decompresses a block in memory to a heap block allocated via malloc(). // On entry: // pSrc_buf, src_buf_len: Pointer and size of the Deflate or zlib source data to decompress. // On return: // Function returns a pointer to the decompressed data, or NULL on failure. // *pOut_len will be set to the decompressed data's size, which could be larger than src_buf_len on uncompressible data. // The caller must call mz_free() on the returned block when it's no longer needed. void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); // tinfl_decompress_mem_to_mem() decompresses a block in memory to another block in memory. // Returns TINFL_DECOMPRESS_MEM_TO_MEM_FAILED on failure, or the number of bytes written on success. #define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1)) size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); // tinfl_decompress_mem_to_callback() decompresses a block in memory to an internal 32KB buffer, and a user provided callback function will be called to flush the buffer. // Returns 1 on success or 0 on failure. typedef int (*tinfl_put_buf_func_ptr)(const void* pBuf, int len, void *pUser); int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); struct tinfl_decompressor_tag; typedef struct tinfl_decompressor_tag tinfl_decompressor; // Max size of LZ dictionary. #define TINFL_LZ_DICT_SIZE 32768 // Return status. typedef enum { TINFL_STATUS_BAD_PARAM = -3, TINFL_STATUS_ADLER32_MISMATCH = -2, TINFL_STATUS_FAILED = -1, TINFL_STATUS_DONE = 0, TINFL_STATUS_NEEDS_MORE_INPUT = 1, TINFL_STATUS_HAS_MORE_OUTPUT = 2 } tinfl_status; // Initializes the decompressor to its initial state. #define tinfl_init(r) do { (r)->m_state = 0; } MZ_MACRO_END #define tinfl_get_adler32(r) (r)->m_check_adler32 // Main low-level decompressor coroutine function. This is the only function actually needed for decompression. All the other functions are just high-level helpers for improved usability. // This is a universal API, i.e. it can be used as a building block to build any desired higher level decompression API. In the limit case, it can be called once per every byte input or output. tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags); // Internal/private bits follow. enum { TINFL_MAX_HUFF_TABLES = 3, TINFL_MAX_HUFF_SYMBOLS_0 = 288, TINFL_MAX_HUFF_SYMBOLS_1 = 32, TINFL_MAX_HUFF_SYMBOLS_2 = 19, TINFL_FAST_LOOKUP_BITS = 10, TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS }; typedef struct { mz_uint8 m_code_size[TINFL_MAX_HUFF_SYMBOLS_0]; mz_int16 m_look_up[TINFL_FAST_LOOKUP_SIZE], m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2]; } tinfl_huff_table; #if MINIZ_HAS_64BIT_REGISTERS #define TINFL_USE_64BIT_BITBUF 1 #endif #if TINFL_USE_64BIT_BITBUF typedef mz_uint64 tinfl_bit_buf_t; #define TINFL_BITBUF_SIZE (64) #else typedef mz_uint32 tinfl_bit_buf_t; #define TINFL_BITBUF_SIZE (32) #endif struct tinfl_decompressor_tag { mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, m_check_adler32, m_dist, m_counter, m_num_extra, m_table_sizes[TINFL_MAX_HUFF_TABLES]; tinfl_bit_buf_t m_bit_buf; size_t m_dist_from_out_buf_start; tinfl_huff_table m_tables[TINFL_MAX_HUFF_TABLES]; mz_uint8 m_raw_header[4], m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137]; }; // ------------------- Low-level Compression API Definitions // Set TDEFL_LESS_MEMORY to 1 to use less memory (compression will be slightly slower, and raw/dynamic blocks will be output more frequently). #define TDEFL_LESS_MEMORY 0 // tdefl_init() compression flags logically OR'd together (low 12 bits contain the max. number of probes per dictionary search): // TDEFL_DEFAULT_MAX_PROBES: The compressor defaults to 128 dictionary probes per dictionary search. 0=Huffman only, 1=Huffman+LZ (fastest/crap compression), 4095=Huffman+LZ (slowest/best compression). enum { TDEFL_HUFFMAN_ONLY = 0, TDEFL_DEFAULT_MAX_PROBES = 128, TDEFL_MAX_PROBES_MASK = 0xFFF }; // TDEFL_WRITE_ZLIB_HEADER: If set, the compressor outputs a zlib header before the deflate data, and the Adler-32 of the source data at the end. Otherwise, you'll get raw deflate data. // TDEFL_COMPUTE_ADLER32: Always compute the adler-32 of the input data (even when not writing zlib headers). // TDEFL_GREEDY_PARSING_FLAG: Set to use faster greedy parsing, instead of more efficient lazy parsing. // TDEFL_NONDETERMINISTIC_PARSING_FLAG: Enable to decrease the compressor's initialization time to the minimum, but the output may vary from run to run given the same input (depending on the contents of memory). // TDEFL_RLE_MATCHES: Only look for RLE matches (matches with a distance of 1) // TDEFL_FILTER_MATCHES: Discards matches <= 5 chars if enabled. // TDEFL_FORCE_ALL_STATIC_BLOCKS: Disable usage of optimized Huffman tables. // TDEFL_FORCE_ALL_RAW_BLOCKS: Only use raw (uncompressed) deflate blocks. // The low 12 bits are reserved to control the max # of hash probes per dictionary lookup (see TDEFL_MAX_PROBES_MASK). enum { TDEFL_WRITE_ZLIB_HEADER = 0x01000, TDEFL_COMPUTE_ADLER32 = 0x02000, TDEFL_GREEDY_PARSING_FLAG = 0x04000, TDEFL_NONDETERMINISTIC_PARSING_FLAG = 0x08000, TDEFL_RLE_MATCHES = 0x10000, TDEFL_FILTER_MATCHES = 0x20000, TDEFL_FORCE_ALL_STATIC_BLOCKS = 0x40000, TDEFL_FORCE_ALL_RAW_BLOCKS = 0x80000 }; // High level compression functions: // tdefl_compress_mem_to_heap() compresses a block in memory to a heap block allocated via malloc(). // On entry: // pSrc_buf, src_buf_len: Pointer and size of source block to compress. // flags: The max match finder probes (default is 128) logically OR'd against the above flags. Higher probes are slower but improve compression. // On return: // Function returns a pointer to the compressed data, or NULL on failure. // *pOut_len will be set to the compressed data's size, which could be larger than src_buf_len on uncompressible data. // The caller must free() the returned block when it's no longer needed. void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); // tdefl_compress_mem_to_mem() compresses a block in memory to another block in memory. // Returns 0 on failure. size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); // Compresses an image to a compressed PNG file in memory. // On entry: // pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4. // The image pitch in bytes per scanline will be w*num_chans. The leftmost pixel on the top scanline is stored first in memory. // level may range from [0,10], use MZ_NO_COMPRESSION, MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc. or a decent default is MZ_DEFAULT_LEVEL // If flip is true, the image will be flipped on the Y axis (useful for OpenGL apps). // On return: // Function returns a pointer to the compressed data, or NULL on failure. // *pLen_out will be set to the size of the PNG image file. // The caller must mz_free() the returned heap block (which will typically be larger than *pLen_out) when it's no longer needed. void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int h, int num_chans, size_t *pLen_out, mz_uint level, mz_bool flip); void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out); // Output stream interface. The compressor uses this interface to write compressed data. It'll typically be called TDEFL_OUT_BUF_SIZE at a time. typedef mz_bool (*tdefl_put_buf_func_ptr)(const void* pBuf, int len, void *pUser); // tdefl_compress_mem_to_output() compresses a block to an output stream. The above helpers use this function internally. mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); enum { TDEFL_MAX_HUFF_TABLES = 3, TDEFL_MAX_HUFF_SYMBOLS_0 = 288, TDEFL_MAX_HUFF_SYMBOLS_1 = 32, TDEFL_MAX_HUFF_SYMBOLS_2 = 19, TDEFL_LZ_DICT_SIZE = 32768, TDEFL_LZ_DICT_SIZE_MASK = TDEFL_LZ_DICT_SIZE - 1, TDEFL_MIN_MATCH_LEN = 3, TDEFL_MAX_MATCH_LEN = 258 }; // TDEFL_OUT_BUF_SIZE MUST be large enough to hold a single entire compressed output block (using static/fixed Huffman codes). #if TDEFL_LESS_MEMORY enum { TDEFL_LZ_CODE_BUF_SIZE = 24 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 12, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS }; #else enum { TDEFL_LZ_CODE_BUF_SIZE = 64 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 15, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS }; #endif // The low-level tdefl functions below may be used directly if the above helper functions aren't flexible enough. The low-level functions don't make any heap allocations, unlike the above helper functions. typedef enum { TDEFL_STATUS_BAD_PARAM = -2, TDEFL_STATUS_PUT_BUF_FAILED = -1, TDEFL_STATUS_OKAY = 0, TDEFL_STATUS_DONE = 1, } tdefl_status; // Must map to MZ_NO_FLUSH, MZ_SYNC_FLUSH, etc. enums typedef enum { TDEFL_NO_FLUSH = 0, TDEFL_SYNC_FLUSH = 2, TDEFL_FULL_FLUSH = 3, TDEFL_FINISH = 4 } tdefl_flush; // tdefl's compression state structure. typedef struct { tdefl_put_buf_func_ptr m_pPut_buf_func; void *m_pPut_buf_user; mz_uint m_flags, m_max_probes[2]; int m_greedy_parsing; mz_uint m_adler32, m_lookahead_pos, m_lookahead_size, m_dict_size; mz_uint8 *m_pLZ_code_buf, *m_pLZ_flags, *m_pOutput_buf, *m_pOutput_buf_end; mz_uint m_num_flags_left, m_total_lz_bytes, m_lz_code_buf_dict_pos, m_bits_in, m_bit_buffer; mz_uint m_saved_match_dist, m_saved_match_len, m_saved_lit, m_output_flush_ofs, m_output_flush_remaining, m_finished, m_block_index, m_wants_to_finish; tdefl_status m_prev_return_status; const void *m_pIn_buf; void *m_pOut_buf; size_t *m_pIn_buf_size, *m_pOut_buf_size; tdefl_flush m_flush; const mz_uint8 *m_pSrc; size_t m_src_buf_left, m_out_buf_ofs; mz_uint8 m_dict[TDEFL_LZ_DICT_SIZE + TDEFL_MAX_MATCH_LEN - 1]; mz_uint16 m_huff_count[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; mz_uint16 m_huff_codes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; mz_uint8 m_huff_code_sizes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; mz_uint8 m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE]; mz_uint16 m_next[TDEFL_LZ_DICT_SIZE]; mz_uint16 m_hash[TDEFL_LZ_HASH_SIZE]; mz_uint8 m_output_buf[TDEFL_OUT_BUF_SIZE]; } tdefl_compressor; // Initializes the compressor. // There is no corresponding deinit() function because the tdefl API's do not dynamically allocate memory. // pBut_buf_func: If NULL, output data will be supplied to the specified callback. In this case, the user should call the tdefl_compress_buffer() API for compression. // If pBut_buf_func is NULL the user should always call the tdefl_compress() API. // flags: See the above enums (TDEFL_HUFFMAN_ONLY, TDEFL_WRITE_ZLIB_HEADER, etc.) tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); // Compresses a block of data, consuming as much of the specified input buffer as possible, and writing as much compressed data to the specified output buffer as possible. tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush); // tdefl_compress_buffer() is only usable when the tdefl_init() is called with a non-NULL tdefl_put_buf_func_ptr. // tdefl_compress_buffer() always consumes the entire input buffer. tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush); tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d); mz_uint32 tdefl_get_adler32(tdefl_compressor *d); // Can't use tdefl_create_comp_flags_from_zip_params if MINIZ_NO_ZLIB_APIS isn't defined, because it uses some of its macros. #ifndef MINIZ_NO_ZLIB_APIS // Create tdefl_compress() flags given zlib-style compression parameters. // level may range from [0,10] (where 10 is absolute max compression, but may be much slower on some files) // window_bits may be -15 (raw deflate) or 15 (zlib) // strategy may be either MZ_DEFAULT_STRATEGY, MZ_FILTERED, MZ_HUFFMAN_ONLY, MZ_RLE, or MZ_FIXED mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy); #endif // #ifndef MINIZ_NO_ZLIB_APIS #ifdef __cplusplus } #endif #endif // MINIZ_HEADER_INCLUDED // ------------------- End of Header: Implementation follows. (If you only want the header, define MINIZ_HEADER_FILE_ONLY.) #ifndef MINIZ_HEADER_FILE_ONLY typedef unsigned char mz_validate_uint16[sizeof(mz_uint16)==2 ? 1 : -1]; typedef unsigned char mz_validate_uint32[sizeof(mz_uint32)==4 ? 1 : -1]; typedef unsigned char mz_validate_uint64[sizeof(mz_uint64)==8 ? 1 : -1]; #include <string.h> #include <assert.h> #define MZ_ASSERT(x) assert(x) #ifdef MINIZ_NO_MALLOC #define MZ_MALLOC(x) NULL #define MZ_FREE(x) (void)x, ((void)0) #define MZ_REALLOC(p, x) NULL #else #define MZ_MALLOC(x) malloc(x) #define MZ_FREE(x) free(x) #define MZ_REALLOC(p, x) realloc(p, x) #endif #define MZ_MAX(a,b) (((a)>(b))?(a):(b)) #define MZ_MIN(a,b) (((a)<(b))?(a):(b)) #define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj)) #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN #define MZ_READ_LE16(p) *((const mz_uint16 *)(p)) #define MZ_READ_LE32(p) *((const mz_uint32 *)(p)) #else #define MZ_READ_LE16(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U)) #define MZ_READ_LE32(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U)) #endif #ifdef _MSC_VER #define MZ_FORCEINLINE __forceinline #elif defined(__GNUC__) #define MZ_FORCEINLINE inline __attribute__((__always_inline__)) #else #define MZ_FORCEINLINE inline #endif #ifdef __cplusplus extern "C" { #endif // ------------------- zlib-style API's mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len) { mz_uint32 i, s1 = (mz_uint32)(adler & 0xffff), s2 = (mz_uint32)(adler >> 16); size_t block_len = buf_len % 5552; if (!ptr) return MZ_ADLER32_INIT; while (buf_len) { for (i = 0; i + 7 < block_len; i += 8, ptr += 8) { s1 += ptr[0], s2 += s1; s1 += ptr[1], s2 += s1; s1 += ptr[2], s2 += s1; s1 += ptr[3], s2 += s1; s1 += ptr[4], s2 += s1; s1 += ptr[5], s2 += s1; s1 += ptr[6], s2 += s1; s1 += ptr[7], s2 += s1; } for ( ; i < block_len; ++i) s1 += *ptr++, s2 += s1; s1 %= 65521U, s2 %= 65521U; buf_len -= block_len; block_len = 5552; } return (s2 << 16) + s1; } // Karl Malbrain's compact CRC-32. See "A compact CCITT crc16 and crc32 C implementation that balances processor cache usage against speed": http://www.geocities.com/malbrain/ mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len) { static const mz_uint32 s_crc32[16] = { 0, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c }; mz_uint32 crcu32 = (mz_uint32)crc; if (!ptr) return MZ_CRC32_INIT; crcu32 = ~crcu32; while (buf_len--) { mz_uint8 b = *ptr++; crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b & 0xF)]; crcu32 = (crcu32 >> 4) ^ s_crc32[(crcu32 & 0xF) ^ (b >> 4)]; } return ~crcu32; } void mz_free(void *p) { MZ_FREE(p); } #ifndef MINIZ_NO_ZLIB_APIS static void *def_alloc_func(void *opaque, size_t items, size_t size) { (void)opaque, (void)items, (void)size; return MZ_MALLOC(items * size); } static void def_free_func(void *opaque, void *address) { (void)opaque, (void)address; MZ_FREE(address); } static void *def_realloc_func(void *opaque, void *address, size_t items, size_t size) { (void)opaque, (void)address, (void)items, (void)size; return MZ_REALLOC(address, items * size); } const char *mz_version(void) { return MZ_VERSION; } int mz_deflateInit(mz_streamp pStream, int level) { return mz_deflateInit2(pStream, level, MZ_DEFLATED, MZ_DEFAULT_WINDOW_BITS, 9, MZ_DEFAULT_STRATEGY); } int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy) { tdefl_compressor *pComp; mz_uint comp_flags = TDEFL_COMPUTE_ADLER32 | tdefl_create_comp_flags_from_zip_params(level, window_bits, strategy); if (!pStream) return MZ_STREAM_ERROR; if ((method != MZ_DEFLATED) || ((mem_level < 1) || (mem_level > 9)) || ((window_bits != MZ_DEFAULT_WINDOW_BITS) && (-window_bits != MZ_DEFAULT_WINDOW_BITS))) return MZ_PARAM_ERROR; pStream->data_type = 0; pStream->adler = MZ_ADLER32_INIT; pStream->msg = NULL; pStream->reserved = 0; pStream->total_in = 0; pStream->total_out = 0; if (!pStream->zalloc) pStream->zalloc = def_alloc_func; if (!pStream->zfree) pStream->zfree = def_free_func; pComp = (tdefl_compressor *)pStream->zalloc(pStream->opaque, 1, sizeof(tdefl_compressor)); if (!pComp) return MZ_MEM_ERROR; pStream->state = (struct mz_internal_state *)pComp; if (tdefl_init(pComp, NULL, NULL, comp_flags) != TDEFL_STATUS_OKAY) { mz_deflateEnd(pStream); return MZ_PARAM_ERROR; } return MZ_OK; } int mz_deflateReset(mz_streamp pStream) { if ((!pStream) || (!pStream->state) || (!pStream->zalloc) || (!pStream->zfree)) return MZ_STREAM_ERROR; pStream->total_in = pStream->total_out = 0; tdefl_init((tdefl_compressor*)pStream->state, NULL, NULL, ((tdefl_compressor*)pStream->state)->m_flags); return MZ_OK; } int mz_deflate(mz_streamp pStream, int flush) { size_t in_bytes, out_bytes; mz_ulong orig_total_in, orig_total_out; int mz_status = MZ_OK; if ((!pStream) || (!pStream->state) || (flush < 0) || (flush > MZ_FINISH) || (!pStream->next_out)) return MZ_STREAM_ERROR; if (!pStream->avail_out) return MZ_BUF_ERROR; if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH; if (((tdefl_compressor*)pStream->state)->m_prev_return_status == TDEFL_STATUS_DONE) return (flush == MZ_FINISH) ? MZ_STREAM_END : MZ_BUF_ERROR; orig_total_in = pStream->total_in; orig_total_out = pStream->total_out; for ( ; ; ) { tdefl_status defl_status; in_bytes = pStream->avail_in; out_bytes = pStream->avail_out; defl_status = tdefl_compress((tdefl_compressor*)pStream->state, pStream->next_in, &in_bytes, pStream->next_out, &out_bytes, (tdefl_flush)flush); pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; pStream->total_in += (mz_uint)in_bytes; pStream->adler = tdefl_get_adler32((tdefl_compressor*)pStream->state); pStream->next_out += (mz_uint)out_bytes; pStream->avail_out -= (mz_uint)out_bytes; pStream->total_out += (mz_uint)out_bytes; if (defl_status < 0) { mz_status = MZ_STREAM_ERROR; break; } else if (defl_status == TDEFL_STATUS_DONE) { mz_status = MZ_STREAM_END; break; } else if (!pStream->avail_out) break; else if ((!pStream->avail_in) && (flush != MZ_FINISH)) { if ((flush) || (pStream->total_in != orig_total_in) || (pStream->total_out != orig_total_out)) break; return MZ_BUF_ERROR; // Can't make forward progress without some input. } } return mz_status; } int mz_deflateEnd(mz_streamp pStream) { if (!pStream) return MZ_STREAM_ERROR; if (pStream->state) { pStream->zfree(pStream->opaque, pStream->state); pStream->state = NULL; } return MZ_OK; } mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len) { (void)pStream; // This is really over conservative. (And lame, but it's actually pretty tricky to compute a true upper bound given the way tdefl's blocking works.) return MZ_MAX(128 + (source_len * 110) / 100, 128 + source_len + ((source_len / (31 * 1024)) + 1) * 5); } int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level) { int status; mz_stream stream; memset(&stream, 0, sizeof(stream)); // In case mz_ulong is 64-bits (argh I hate longs). if ((source_len | *pDest_len) > 0xFFFFFFFFU) return MZ_PARAM_ERROR; stream.next_in = pSource; stream.avail_in = (mz_uint32)source_len; stream.next_out = pDest; stream.avail_out = (mz_uint32)*pDest_len; status = mz_deflateInit(&stream, level); if (status != MZ_OK) return status; status = mz_deflate(&stream, MZ_FINISH); if (status != MZ_STREAM_END) { mz_deflateEnd(&stream); return (status == MZ_OK) ? MZ_BUF_ERROR : status; } *pDest_len = stream.total_out; return mz_deflateEnd(&stream); } int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len) { return mz_compress2(pDest, pDest_len, pSource, source_len, MZ_DEFAULT_COMPRESSION); } mz_ulong mz_compressBound(mz_ulong source_len) { return mz_deflateBound(NULL, source_len); } typedef struct { tinfl_decompressor m_decomp; mz_uint m_dict_ofs, m_dict_avail, m_first_call, m_has_flushed; int m_window_bits; mz_uint8 m_dict[TINFL_LZ_DICT_SIZE]; tinfl_status m_last_status; } inflate_state; int mz_inflateInit2(mz_streamp pStream, int window_bits) { inflate_state *pDecomp; if (!pStream) return MZ_STREAM_ERROR; if ((window_bits != MZ_DEFAULT_WINDOW_BITS) && (-window_bits != MZ_DEFAULT_WINDOW_BITS)) return MZ_PARAM_ERROR; pStream->data_type = 0; pStream->adler = 0; pStream->msg = NULL; pStream->total_in = 0; pStream->total_out = 0; pStream->reserved = 0; if (!pStream->zalloc) pStream->zalloc = def_alloc_func; if (!pStream->zfree) pStream->zfree = def_free_func; pDecomp = (inflate_state*)pStream->zalloc(pStream->opaque, 1, sizeof(inflate_state)); if (!pDecomp) return MZ_MEM_ERROR; pStream->state = (struct mz_internal_state *)pDecomp; tinfl_init(&pDecomp->m_decomp); pDecomp->m_dict_ofs = 0; pDecomp->m_dict_avail = 0; pDecomp->m_last_status = TINFL_STATUS_NEEDS_MORE_INPUT; pDecomp->m_first_call = 1; pDecomp->m_has_flushed = 0; pDecomp->m_window_bits = window_bits; return MZ_OK; } int mz_inflateInit(mz_streamp pStream) { return mz_inflateInit2(pStream, MZ_DEFAULT_WINDOW_BITS); } int mz_inflate(mz_streamp pStream, int flush) { inflate_state* pState; mz_uint n, first_call, decomp_flags = TINFL_FLAG_COMPUTE_ADLER32; size_t in_bytes, out_bytes, orig_avail_in; tinfl_status status; if ((!pStream) || (!pStream->state)) return MZ_STREAM_ERROR; if (flush == MZ_PARTIAL_FLUSH) flush = MZ_SYNC_FLUSH; if ((flush) && (flush != MZ_SYNC_FLUSH) && (flush != MZ_FINISH)) return MZ_STREAM_ERROR; pState = (inflate_state*)pStream->state; if (pState->m_window_bits > 0) decomp_flags |= TINFL_FLAG_PARSE_ZLIB_HEADER; orig_avail_in = pStream->avail_in; first_call = pState->m_first_call; pState->m_first_call = 0; if (pState->m_last_status < 0) return MZ_DATA_ERROR; if (pState->m_has_flushed && (flush != MZ_FINISH)) return MZ_STREAM_ERROR; pState->m_has_flushed |= (flush == MZ_FINISH); if ((flush == MZ_FINISH) && (first_call)) { // MZ_FINISH on the first call implies that the input and output buffers are large enough to hold the entire compressed/decompressed file. decomp_flags |= TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF; in_bytes = pStream->avail_in; out_bytes = pStream->avail_out; status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pStream->next_out, pStream->next_out, &out_bytes, decomp_flags); pState->m_last_status = status; pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; pStream->total_in += (mz_uint)in_bytes; pStream->adler = tinfl_get_adler32(&pState->m_decomp); pStream->next_out += (mz_uint)out_bytes; pStream->avail_out -= (mz_uint)out_bytes; pStream->total_out += (mz_uint)out_bytes; if (status < 0) return MZ_DATA_ERROR; else if (status != TINFL_STATUS_DONE) { pState->m_last_status = TINFL_STATUS_FAILED; return MZ_BUF_ERROR; } return MZ_STREAM_END; } // flush != MZ_FINISH then we must assume there's more input. if (flush != MZ_FINISH) decomp_flags |= TINFL_FLAG_HAS_MORE_INPUT; if (pState->m_dict_avail) { n = MZ_MIN(pState->m_dict_avail, pStream->avail_out); memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n); pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n; pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1); return ((pState->m_last_status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK; } for ( ; ; ) { in_bytes = pStream->avail_in; out_bytes = TINFL_LZ_DICT_SIZE - pState->m_dict_ofs; status = tinfl_decompress(&pState->m_decomp, pStream->next_in, &in_bytes, pState->m_dict, pState->m_dict + pState->m_dict_ofs, &out_bytes, decomp_flags); pState->m_last_status = status; pStream->next_in += (mz_uint)in_bytes; pStream->avail_in -= (mz_uint)in_bytes; pStream->total_in += (mz_uint)in_bytes; pStream->adler = tinfl_get_adler32(&pState->m_decomp); pState->m_dict_avail = (mz_uint)out_bytes; n = MZ_MIN(pState->m_dict_avail, pStream->avail_out); memcpy(pStream->next_out, pState->m_dict + pState->m_dict_ofs, n); pStream->next_out += n; pStream->avail_out -= n; pStream->total_out += n; pState->m_dict_avail -= n; pState->m_dict_ofs = (pState->m_dict_ofs + n) & (TINFL_LZ_DICT_SIZE - 1); if (status < 0) return MZ_DATA_ERROR; // Stream is corrupted (there could be some uncompressed data left in the output dictionary - oh well). else if ((status == TINFL_STATUS_NEEDS_MORE_INPUT) && (!orig_avail_in)) return MZ_BUF_ERROR; // Signal caller that we can't make forward progress without supplying more input or by setting flush to MZ_FINISH. else if (flush == MZ_FINISH) { // The output buffer MUST be large to hold the remaining uncompressed data when flush==MZ_FINISH. if (status == TINFL_STATUS_DONE) return pState->m_dict_avail ? MZ_BUF_ERROR : MZ_STREAM_END; // status here must be TINFL_STATUS_HAS_MORE_OUTPUT, which means there's at least 1 more byte on the way. If there's no more room left in the output buffer then something is wrong. else if (!pStream->avail_out) return MZ_BUF_ERROR; } else if ((status == TINFL_STATUS_DONE) || (!pStream->avail_in) || (!pStream->avail_out) || (pState->m_dict_avail)) break; } return ((status == TINFL_STATUS_DONE) && (!pState->m_dict_avail)) ? MZ_STREAM_END : MZ_OK; } int mz_inflateEnd(mz_streamp pStream) { if (!pStream) return MZ_STREAM_ERROR; if (pStream->state) { pStream->zfree(pStream->opaque, pStream->state); pStream->state = NULL; } return MZ_OK; } int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len) { mz_stream stream; int status; memset(&stream, 0, sizeof(stream)); // In case mz_ulong is 64-bits (argh I hate longs). if ((source_len | *pDest_len) > 0xFFFFFFFFU) return MZ_PARAM_ERROR; stream.next_in = pSource; stream.avail_in = (mz_uint32)source_len; stream.next_out = pDest; stream.avail_out = (mz_uint32)*pDest_len; status = mz_inflateInit(&stream); if (status != MZ_OK) return status; status = mz_inflate(&stream, MZ_FINISH); if (status != MZ_STREAM_END) { mz_inflateEnd(&stream); return ((status == MZ_BUF_ERROR) && (!stream.avail_in)) ? MZ_DATA_ERROR : status; } *pDest_len = stream.total_out; return mz_inflateEnd(&stream); } const char *mz_error(int err) { static struct { int m_err; const char *m_pDesc; } s_error_descs[] = { { MZ_OK, "" }, { MZ_STREAM_END, "stream end" }, { MZ_NEED_DICT, "need dictionary" }, { MZ_ERRNO, "file error" }, { MZ_STREAM_ERROR, "stream error" }, { MZ_DATA_ERROR, "data error" }, { MZ_MEM_ERROR, "out of memory" }, { MZ_BUF_ERROR, "buf error" }, { MZ_VERSION_ERROR, "version error" }, { MZ_PARAM_ERROR, "parameter error" } }; mz_uint i; for (i = 0; i < sizeof(s_error_descs) / sizeof(s_error_descs[0]); ++i) if (s_error_descs[i].m_err == err) return s_error_descs[i].m_pDesc; return NULL; } #endif //MINIZ_NO_ZLIB_APIS // ------------------- Low-level Decompression (completely independent from all compression API's) #define TINFL_MEMCPY(d, s, l) memcpy(d, s, l) #define TINFL_MEMSET(p, c, l) memset(p, c, l) #define TINFL_CR_BEGIN switch(r->m_state) { case 0: #define TINFL_CR_RETURN(state_index, result) do { status = result; r->m_state = state_index; goto common_exit; case state_index:; } MZ_MACRO_END #define TINFL_CR_RETURN_FOREVER(state_index, result) do { for ( ; ; ) { TINFL_CR_RETURN(state_index, result); } } MZ_MACRO_END #define TINFL_CR_FINISH } // TODO: If the caller has indicated that there's no more input, and we attempt to read beyond the input buf, then something is wrong with the input because the inflator never // reads ahead more than it needs to. Currently TINFL_GET_BYTE() pads the end of the stream with 0's in this scenario. #define TINFL_GET_BYTE(state_index, c) do { \ if (pIn_buf_cur >= pIn_buf_end) { \ for ( ; ; ) { \ if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) { \ TINFL_CR_RETURN(state_index, TINFL_STATUS_NEEDS_MORE_INPUT); \ if (pIn_buf_cur < pIn_buf_end) { \ c = *pIn_buf_cur++; \ break; \ } \ } else { \ c = 0; \ break; \ } \ } \ } else c = *pIn_buf_cur++; } MZ_MACRO_END #define TINFL_NEED_BITS(state_index, n) do { mz_uint c; TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; } while (num_bits < (mz_uint)(n)) #define TINFL_SKIP_BITS(state_index, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END #define TINFL_GET_BITS(state_index, b, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } b = bit_buf & ((1 << (n)) - 1); bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END // TINFL_HUFF_BITBUF_FILL() is only used rarely, when the number of bytes remaining in the input buffer falls below 2. // It reads just enough bytes from the input stream that are needed to decode the next Huffman code (and absolutely no more). It works by trying to fully decode a // Huffman code by using whatever bits are currently present in the bit buffer. If this fails, it reads another byte, and tries again until it succeeds or until the // bit buffer contains >=15 bits (deflate's max. Huffman code size). #define TINFL_HUFF_BITBUF_FILL(state_index, pHuff) \ do { \ temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]; \ if (temp >= 0) { \ code_len = temp >> 9; \ if ((code_len) && (num_bits >= code_len)) \ break; \ } else if (num_bits > TINFL_FAST_LOOKUP_BITS) { \ code_len = TINFL_FAST_LOOKUP_BITS; \ do { \ temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; \ } while ((temp < 0) && (num_bits >= (code_len + 1))); if (temp >= 0) break; \ } TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; \ } while (num_bits < 15); // TINFL_HUFF_DECODE() decodes the next Huffman coded symbol. It's more complex than you would initially expect because the zlib API expects the decompressor to never read // beyond the final byte of the deflate stream. (In other words, when this macro wants to read another byte from the input, it REALLY needs another byte in order to fully // decode the next Huffman code.) Handling this properly is particularly important on raw deflate (non-zlib) streams, which aren't followed by a byte aligned adler-32. // The slow path is only executed at the very end of the input buffer. #define TINFL_HUFF_DECODE(state_index, sym, pHuff) do { \ int temp; mz_uint code_len, c; \ if (num_bits < 15) { \ if ((pIn_buf_end - pIn_buf_cur) < 2) { \ TINFL_HUFF_BITBUF_FILL(state_index, pHuff); \ } else { \ bit_buf |= (((tinfl_bit_buf_t)pIn_buf_cur[0]) << num_bits) | (((tinfl_bit_buf_t)pIn_buf_cur[1]) << (num_bits + 8)); pIn_buf_cur += 2; num_bits += 16; \ } \ } \ if ((temp = (pHuff)->m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) \ code_len = temp >> 9, temp &= 511; \ else { \ code_len = TINFL_FAST_LOOKUP_BITS; do { temp = (pHuff)->m_tree[~temp + ((bit_buf >> code_len++) & 1)]; } while (temp < 0); \ } sym = temp; bit_buf >>= code_len; num_bits -= code_len; } MZ_MACRO_END tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags) { static const int s_length_base[31] = { 3,4,5,6,7,8,9,10,11,13, 15,17,19,23,27,31,35,43,51,59, 67,83,99,115,131,163,195,227,258,0,0 }; static const int s_length_extra[31]= { 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 }; static const int s_dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, 257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; static const int s_dist_extra[32] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; static const mz_uint8 s_length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; static const int s_min_table_sizes[3] = { 257, 1, 4 }; tinfl_status status = TINFL_STATUS_FAILED; mz_uint32 num_bits, dist, counter, num_extra; tinfl_bit_buf_t bit_buf; const mz_uint8 *pIn_buf_cur = pIn_buf_next, *const pIn_buf_end = pIn_buf_next + *pIn_buf_size; mz_uint8 *pOut_buf_cur = pOut_buf_next, *const pOut_buf_end = pOut_buf_next + *pOut_buf_size; size_t out_buf_size_mask = (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) ? (size_t)-1 : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, dist_from_out_buf_start; // Ensure the output buffer's size is a power of 2, unless the output buffer is large enough to hold the entire output file (in which case it doesn't matter). if (((out_buf_size_mask + 1) & out_buf_size_mask) || (pOut_buf_next < pOut_buf_start)) { *pIn_buf_size = *pOut_buf_size = 0; return TINFL_STATUS_BAD_PARAM; } num_bits = r->m_num_bits; bit_buf = r->m_bit_buf; dist = r->m_dist; counter = r->m_counter; num_extra = r->m_num_extra; dist_from_out_buf_start = r->m_dist_from_out_buf_start; TINFL_CR_BEGIN bit_buf = num_bits = dist = counter = num_extra = r->m_zhdr0 = r->m_zhdr1 = 0; r->m_z_adler32 = r->m_check_adler32 = 1; if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) { TINFL_GET_BYTE(1, r->m_zhdr0); TINFL_GET_BYTE(2, r->m_zhdr1); counter = (((r->m_zhdr0 * 256 + r->m_zhdr1) % 31 != 0) || (r->m_zhdr1 & 32) || ((r->m_zhdr0 & 15) != 8)); if (!(decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) counter |= (((1U << (8U + (r->m_zhdr0 >> 4))) > 32768U) || ((out_buf_size_mask + 1) < (size_t)(1U << (8U + (r->m_zhdr0 >> 4))))); if (counter) { TINFL_CR_RETURN_FOREVER(36, TINFL_STATUS_FAILED); } } do { TINFL_GET_BITS(3, r->m_final, 3); r->m_type = r->m_final >> 1; if (r->m_type == 0) { TINFL_SKIP_BITS(5, num_bits & 7); for (counter = 0; counter < 4; ++counter) { if (num_bits) TINFL_GET_BITS(6, r->m_raw_header[counter], 8); else TINFL_GET_BYTE(7, r->m_raw_header[counter]); } if ((counter = (r->m_raw_header[0] | (r->m_raw_header[1] << 8))) != (mz_uint)(0xFFFF ^ (r->m_raw_header[2] | (r->m_raw_header[3] << 8)))) { TINFL_CR_RETURN_FOREVER(39, TINFL_STATUS_FAILED); } while ((counter) && (num_bits)) { TINFL_GET_BITS(51, dist, 8); while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(52, TINFL_STATUS_HAS_MORE_OUTPUT); } *pOut_buf_cur++ = (mz_uint8)dist; counter--; } while (counter) { size_t n; while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(9, TINFL_STATUS_HAS_MORE_OUTPUT); } while (pIn_buf_cur >= pIn_buf_end) { if (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) { TINFL_CR_RETURN(38, TINFL_STATUS_NEEDS_MORE_INPUT); } else { TINFL_CR_RETURN_FOREVER(40, TINFL_STATUS_FAILED); } } n = MZ_MIN(MZ_MIN((size_t)(pOut_buf_end - pOut_buf_cur), (size_t)(pIn_buf_end - pIn_buf_cur)), counter); TINFL_MEMCPY(pOut_buf_cur, pIn_buf_cur, n); pIn_buf_cur += n; pOut_buf_cur += n; counter -= (mz_uint)n; } } else if (r->m_type == 3) { TINFL_CR_RETURN_FOREVER(10, TINFL_STATUS_FAILED); } else { if (r->m_type == 1) { mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i; r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32); for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8; } else { for (counter = 0; counter < 3; counter++) { TINFL_GET_BITS(11, r->m_table_sizes[counter], "\05\05\04"[counter]); r->m_table_sizes[counter] += s_min_table_sizes[counter]; } MZ_CLEAR_OBJ(r->m_tables[2].m_code_size); for (counter = 0; counter < r->m_table_sizes[2]; counter++) { mz_uint s; TINFL_GET_BITS(14, s, 3); r->m_tables[2].m_code_size[s_length_dezigzag[counter]] = (mz_uint8)s; } r->m_table_sizes[2] = 19; } for ( ; (int)r->m_type >= 0; r->m_type--) { int tree_next, tree_cur; tinfl_huff_table *pTable; mz_uint i, j, used_syms, total, sym_index, next_code[17], total_syms[16]; pTable = &r->m_tables[r->m_type]; MZ_CLEAR_OBJ(total_syms); MZ_CLEAR_OBJ(pTable->m_look_up); MZ_CLEAR_OBJ(pTable->m_tree); for (i = 0; i < r->m_table_sizes[r->m_type]; ++i) total_syms[pTable->m_code_size[i]]++; used_syms = 0, total = 0; next_code[0] = next_code[1] = 0; for (i = 1; i <= 15; ++i) { used_syms += total_syms[i]; next_code[i + 1] = (total = ((total + total_syms[i]) << 1)); } if ((65536 != total) && (used_syms > 1)) { TINFL_CR_RETURN_FOREVER(35, TINFL_STATUS_FAILED); } for (tree_next = -1, sym_index = 0; sym_index < r->m_table_sizes[r->m_type]; ++sym_index) { mz_uint rev_code = 0, l, cur_code, code_size = pTable->m_code_size[sym_index]; if (!code_size) continue; cur_code = next_code[code_size]++; for (l = code_size; l > 0; l--, cur_code >>= 1) rev_code = (rev_code << 1) | (cur_code & 1); if (code_size <= TINFL_FAST_LOOKUP_BITS) { mz_int16 k = (mz_int16)((code_size << 9) | sym_index); while (rev_code < TINFL_FAST_LOOKUP_SIZE) { pTable->m_look_up[rev_code] = k; rev_code += (1 << code_size); } continue; } if (0 == (tree_cur = pTable->m_look_up[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)])) { pTable->m_look_up[rev_code & (TINFL_FAST_LOOKUP_SIZE - 1)] = (mz_int16)tree_next; tree_cur = tree_next; tree_next -= 2; } rev_code >>= (TINFL_FAST_LOOKUP_BITS - 1); for (j = code_size; j > (TINFL_FAST_LOOKUP_BITS + 1); j--) { tree_cur -= ((rev_code >>= 1) & 1); if (!pTable->m_tree[-tree_cur - 1]) { pTable->m_tree[-tree_cur - 1] = (mz_int16)tree_next; tree_cur = tree_next; tree_next -= 2; } else tree_cur = pTable->m_tree[-tree_cur - 1]; } tree_cur -= ((rev_code >>= 1) & 1); pTable->m_tree[-tree_cur - 1] = (mz_int16)sym_index; } if (r->m_type == 2) { for (counter = 0; counter < (r->m_table_sizes[0] + r->m_table_sizes[1]); ) { mz_uint s; TINFL_HUFF_DECODE(16, dist, &r->m_tables[2]); if (dist < 16) { r->m_len_codes[counter++] = (mz_uint8)dist; continue; } if ((dist == 16) && (!counter)) { TINFL_CR_RETURN_FOREVER(17, TINFL_STATUS_FAILED); } num_extra = "\02\03\07"[dist - 16]; TINFL_GET_BITS(18, s, num_extra); s += "\03\03\013"[dist - 16]; TINFL_MEMSET(r->m_len_codes + counter, (dist == 16) ? r->m_len_codes[counter - 1] : 0, s); counter += s; } if ((r->m_table_sizes[0] + r->m_table_sizes[1]) != counter) { TINFL_CR_RETURN_FOREVER(21, TINFL_STATUS_FAILED); } TINFL_MEMCPY(r->m_tables[0].m_code_size, r->m_len_codes, r->m_table_sizes[0]); TINFL_MEMCPY(r->m_tables[1].m_code_size, r->m_len_codes + r->m_table_sizes[0], r->m_table_sizes[1]); } } for ( ; ; ) { mz_uint8 *pSrc; for ( ; ; ) { if (((pIn_buf_end - pIn_buf_cur) < 4) || ((pOut_buf_end - pOut_buf_cur) < 2)) { TINFL_HUFF_DECODE(23, counter, &r->m_tables[0]); if (counter >= 256) break; while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(24, TINFL_STATUS_HAS_MORE_OUTPUT); } *pOut_buf_cur++ = (mz_uint8)counter; } else { int sym2; mz_uint code_len; #if TINFL_USE_64BIT_BITBUF if (num_bits < 30) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE32(pIn_buf_cur)) << num_bits); pIn_buf_cur += 4; num_bits += 32; } #else if (num_bits < 15) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); pIn_buf_cur += 2; num_bits += 16; } #endif if ((sym2 = r->m_tables[0].m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) code_len = sym2 >> 9; else { code_len = TINFL_FAST_LOOKUP_BITS; do { sym2 = r->m_tables[0].m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; } while (sym2 < 0); } counter = sym2; bit_buf >>= code_len; num_bits -= code_len; if (counter & 256) break; #if !TINFL_USE_64BIT_BITBUF if (num_bits < 15) { bit_buf |= (((tinfl_bit_buf_t)MZ_READ_LE16(pIn_buf_cur)) << num_bits); pIn_buf_cur += 2; num_bits += 16; } #endif if ((sym2 = r->m_tables[0].m_look_up[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) code_len = sym2 >> 9; else { code_len = TINFL_FAST_LOOKUP_BITS; do { sym2 = r->m_tables[0].m_tree[~sym2 + ((bit_buf >> code_len++) & 1)]; } while (sym2 < 0); } bit_buf >>= code_len; num_bits -= code_len; pOut_buf_cur[0] = (mz_uint8)counter; if (sym2 & 256) { pOut_buf_cur++; counter = sym2; break; } pOut_buf_cur[1] = (mz_uint8)sym2; pOut_buf_cur += 2; } } if ((counter &= 511) == 256) break; num_extra = s_length_extra[counter - 257]; counter = s_length_base[counter - 257]; if (num_extra) { mz_uint extra_bits; TINFL_GET_BITS(25, extra_bits, num_extra); counter += extra_bits; } TINFL_HUFF_DECODE(26, dist, &r->m_tables[1]); num_extra = s_dist_extra[dist]; dist = s_dist_base[dist]; if (num_extra) { mz_uint extra_bits; TINFL_GET_BITS(27, extra_bits, num_extra); dist += extra_bits; } dist_from_out_buf_start = pOut_buf_cur - pOut_buf_start; if ((dist > dist_from_out_buf_start) && (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) { TINFL_CR_RETURN_FOREVER(37, TINFL_STATUS_FAILED); } pSrc = pOut_buf_start + ((dist_from_out_buf_start - dist) & out_buf_size_mask); if ((MZ_MAX(pOut_buf_cur, pSrc) + counter) > pOut_buf_end) { while (counter--) { while (pOut_buf_cur >= pOut_buf_end) { TINFL_CR_RETURN(53, TINFL_STATUS_HAS_MORE_OUTPUT); } *pOut_buf_cur++ = pOut_buf_start[(dist_from_out_buf_start++ - dist) & out_buf_size_mask]; } continue; } #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES else if ((counter >= 9) && (counter <= dist)) { const mz_uint8 *pSrc_end = pSrc + (counter & ~7); do { ((mz_uint32 *)pOut_buf_cur)[0] = ((const mz_uint32 *)pSrc)[0]; ((mz_uint32 *)pOut_buf_cur)[1] = ((const mz_uint32 *)pSrc)[1]; pOut_buf_cur += 8; } while ((pSrc += 8) < pSrc_end); if ((counter &= 7) < 3) { if (counter) { pOut_buf_cur[0] = pSrc[0]; if (counter > 1) pOut_buf_cur[1] = pSrc[1]; pOut_buf_cur += counter; } continue; } } #endif do { pOut_buf_cur[0] = pSrc[0]; pOut_buf_cur[1] = pSrc[1]; pOut_buf_cur[2] = pSrc[2]; pOut_buf_cur += 3; pSrc += 3; } while ((int)(counter -= 3) > 2); if ((int)counter > 0) { pOut_buf_cur[0] = pSrc[0]; if ((int)counter > 1) pOut_buf_cur[1] = pSrc[1]; pOut_buf_cur += counter; } } } } while (!(r->m_final & 1)); if (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) { TINFL_SKIP_BITS(32, num_bits & 7); for (counter = 0; counter < 4; ++counter) { mz_uint s; if (num_bits) TINFL_GET_BITS(41, s, 8); else TINFL_GET_BYTE(42, s); r->m_z_adler32 = (r->m_z_adler32 << 8) | s; } } TINFL_CR_RETURN_FOREVER(34, TINFL_STATUS_DONE); TINFL_CR_FINISH common_exit: r->m_num_bits = num_bits; r->m_bit_buf = bit_buf; r->m_dist = dist; r->m_counter = counter; r->m_num_extra = num_extra; r->m_dist_from_out_buf_start = dist_from_out_buf_start; *pIn_buf_size = pIn_buf_cur - pIn_buf_next; *pOut_buf_size = pOut_buf_cur - pOut_buf_next; if ((decomp_flags & (TINFL_FLAG_PARSE_ZLIB_HEADER | TINFL_FLAG_COMPUTE_ADLER32)) && (status >= 0)) { const mz_uint8 *ptr = pOut_buf_next; size_t buf_len = *pOut_buf_size; mz_uint32 i, s1 = r->m_check_adler32 & 0xffff, s2 = r->m_check_adler32 >> 16; size_t block_len = buf_len % 5552; while (buf_len) { for (i = 0; i + 7 < block_len; i += 8, ptr += 8) { s1 += ptr[0], s2 += s1; s1 += ptr[1], s2 += s1; s1 += ptr[2], s2 += s1; s1 += ptr[3], s2 += s1; s1 += ptr[4], s2 += s1; s1 += ptr[5], s2 += s1; s1 += ptr[6], s2 += s1; s1 += ptr[7], s2 += s1; } for ( ; i < block_len; ++i) s1 += *ptr++, s2 += s1; s1 %= 65521U, s2 %= 65521U; buf_len -= block_len; block_len = 5552; } r->m_check_adler32 = (s2 << 16) + s1; if ((status == TINFL_STATUS_DONE) && (decomp_flags & TINFL_FLAG_PARSE_ZLIB_HEADER) && (r->m_check_adler32 != r->m_z_adler32)) status = TINFL_STATUS_ADLER32_MISMATCH; } return status; } // Higher level helper functions. void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags) { tinfl_decompressor decomp; void *pBuf = NULL, *pNew_buf; size_t src_buf_ofs = 0, out_buf_capacity = 0; *pOut_len = 0; tinfl_init(&decomp); for ( ; ; ) { size_t src_buf_size = src_buf_len - src_buf_ofs, dst_buf_size = out_buf_capacity - *pOut_len, new_out_buf_capacity; tinfl_status status = tinfl_decompress(&decomp, (const mz_uint8*)pSrc_buf + src_buf_ofs, &src_buf_size, (mz_uint8*)pBuf, pBuf ? (mz_uint8*)pBuf + *pOut_len : NULL, &dst_buf_size, (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF); if ((status < 0) || (status == TINFL_STATUS_NEEDS_MORE_INPUT)) { MZ_FREE(pBuf); *pOut_len = 0; return NULL; } src_buf_ofs += src_buf_size; *pOut_len += dst_buf_size; if (status == TINFL_STATUS_DONE) break; new_out_buf_capacity = out_buf_capacity * 2; if (new_out_buf_capacity < 128) new_out_buf_capacity = 128; pNew_buf = MZ_REALLOC(pBuf, new_out_buf_capacity); if (!pNew_buf) { MZ_FREE(pBuf); *pOut_len = 0; return NULL; } pBuf = pNew_buf; out_buf_capacity = new_out_buf_capacity; } return pBuf; } size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags) { tinfl_decompressor decomp; tinfl_status status; tinfl_init(&decomp); status = tinfl_decompress(&decomp, (const mz_uint8*)pSrc_buf, &src_buf_len, (mz_uint8*)pOut_buf, (mz_uint8*)pOut_buf, &out_buf_len, (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF); return (status != TINFL_STATUS_DONE) ? TINFL_DECOMPRESS_MEM_TO_MEM_FAILED : out_buf_len; } int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags) { int result = 0; tinfl_decompressor decomp; mz_uint8 *pDict = (mz_uint8*)MZ_MALLOC(TINFL_LZ_DICT_SIZE); size_t in_buf_ofs = 0, dict_ofs = 0; if (!pDict) return TINFL_STATUS_FAILED; tinfl_init(&decomp); for ( ; ; ) { size_t in_buf_size = *pIn_buf_size - in_buf_ofs, dst_buf_size = TINFL_LZ_DICT_SIZE - dict_ofs; tinfl_status status = tinfl_decompress(&decomp, (const mz_uint8*)pIn_buf + in_buf_ofs, &in_buf_size, pDict, pDict + dict_ofs, &dst_buf_size, (flags & ~(TINFL_FLAG_HAS_MORE_INPUT | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF))); in_buf_ofs += in_buf_size; if ((dst_buf_size) && (!(*pPut_buf_func)(pDict + dict_ofs, (int)dst_buf_size, pPut_buf_user))) break; if (status != TINFL_STATUS_HAS_MORE_OUTPUT) { result = (status == TINFL_STATUS_DONE); break; } dict_ofs = (dict_ofs + dst_buf_size) & (TINFL_LZ_DICT_SIZE - 1); } MZ_FREE(pDict); *pIn_buf_size = in_buf_ofs; return result; } // ------------------- Low-level Compression (independent from all decompression API's) // Purposely making these tables static for faster init and thread safety. static const mz_uint16 s_tdefl_len_sym[256] = { 257,258,259,260,261,262,263,264,265,265,266,266,267,267,268,268,269,269,269,269,270,270,270,270,271,271,271,271,272,272,272,272, 273,273,273,273,273,273,273,273,274,274,274,274,274,274,274,274,275,275,275,275,275,275,275,275,276,276,276,276,276,276,276,276, 277,277,277,277,277,277,277,277,277,277,277,277,277,277,277,277,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278,278, 279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280, 281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281,281, 282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282,282, 283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283, 284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,285 }; static const mz_uint8 s_tdefl_len_extra[256] = { 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0 }; static const mz_uint8 s_tdefl_small_dist_sym[512] = { 0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14, 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, 14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17 }; static const mz_uint8 s_tdefl_small_dist_extra[512] = { 0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7 }; static const mz_uint8 s_tdefl_large_dist_sym[128] = { 0,0,18,19,20,20,21,21,22,22,22,22,23,23,23,23,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26, 26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28, 28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29 }; static const mz_uint8 s_tdefl_large_dist_extra[128] = { 0,0,8,8,9,9,9,9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13 }; // Radix sorts tdefl_sym_freq[] array by 16-bit key m_key. Returns ptr to sorted values. typedef struct { mz_uint16 m_key, m_sym_index; } tdefl_sym_freq; static tdefl_sym_freq* tdefl_radix_sort_syms(mz_uint num_syms, tdefl_sym_freq* pSyms0, tdefl_sym_freq* pSyms1) { mz_uint32 total_passes = 2, pass_shift, pass, i, hist[256 * 2]; tdefl_sym_freq* pCur_syms = pSyms0, *pNew_syms = pSyms1; MZ_CLEAR_OBJ(hist); for (i = 0; i < num_syms; i++) { mz_uint freq = pSyms0[i].m_key; hist[freq & 0xFF]++; hist[256 + ((freq >> 8) & 0xFF)]++; } while ((total_passes > 1) && (num_syms == hist[(total_passes - 1) * 256])) total_passes--; for (pass_shift = 0, pass = 0; pass < total_passes; pass++, pass_shift += 8) { const mz_uint32* pHist = &hist[pass << 8]; mz_uint offsets[256], cur_ofs = 0; for (i = 0; i < 256; i++) { offsets[i] = cur_ofs; cur_ofs += pHist[i]; } for (i = 0; i < num_syms; i++) pNew_syms[offsets[(pCur_syms[i].m_key >> pass_shift) & 0xFF]++] = pCur_syms[i]; { tdefl_sym_freq* t = pCur_syms; pCur_syms = pNew_syms; pNew_syms = t; } } return pCur_syms; } // tdefl_calculate_minimum_redundancy() originally written by: Alistair Moffat, [email protected], Jyrki Katajainen, [email protected], November 1996. static void tdefl_calculate_minimum_redundancy(tdefl_sym_freq *A, int n) { int root, leaf, next, avbl, used, dpth; if (n==0) return; else if (n==1) { A[0].m_key = 1; return; } A[0].m_key += A[1].m_key; root = 0; leaf = 2; for (next=1; next < n-1; next++) { if (leaf>=n || A[root].m_key<A[leaf].m_key) { A[next].m_key = A[root].m_key; A[root++].m_key = (mz_uint16)next; } else A[next].m_key = A[leaf++].m_key; if (leaf>=n || (root<next && A[root].m_key<A[leaf].m_key)) { A[next].m_key = (mz_uint16)(A[next].m_key + A[root].m_key); A[root++].m_key = (mz_uint16)next; } else A[next].m_key = (mz_uint16)(A[next].m_key + A[leaf++].m_key); } A[n-2].m_key = 0; for (next=n-3; next>=0; next--) A[next].m_key = A[A[next].m_key].m_key+1; avbl = 1; used = dpth = 0; root = n-2; next = n-1; while (avbl>0) { while (root>=0 && (int)A[root].m_key==dpth) { used++; root--; } while (avbl>used) { A[next--].m_key = (mz_uint16)(dpth); avbl--; } avbl = 2*used; dpth++; used = 0; } } // Limits canonical Huffman code table's max code size. enum { TDEFL_MAX_SUPPORTED_HUFF_CODESIZE = 32 }; static void tdefl_huffman_enforce_max_code_size(int *pNum_codes, int code_list_len, int max_code_size) { int i; mz_uint32 total = 0; if (code_list_len <= 1) return; for (i = max_code_size + 1; i <= TDEFL_MAX_SUPPORTED_HUFF_CODESIZE; i++) pNum_codes[max_code_size] += pNum_codes[i]; for (i = max_code_size; i > 0; i--) total += (((mz_uint32)pNum_codes[i]) << (max_code_size - i)); while (total != (1UL << max_code_size)) { pNum_codes[max_code_size]--; for (i = max_code_size - 1; i > 0; i--) if (pNum_codes[i]) { pNum_codes[i]--; pNum_codes[i + 1] += 2; break; } total--; } } static void tdefl_optimize_huffman_table(tdefl_compressor *d, int table_num, int table_len, int code_size_limit, int static_table) { int i, j, l, num_codes[1 + TDEFL_MAX_SUPPORTED_HUFF_CODESIZE]; mz_uint next_code[TDEFL_MAX_SUPPORTED_HUFF_CODESIZE + 1]; MZ_CLEAR_OBJ(num_codes); if (static_table) { for (i = 0; i < table_len; i++) num_codes[d->m_huff_code_sizes[table_num][i]]++; } else { tdefl_sym_freq syms0[TDEFL_MAX_HUFF_SYMBOLS], syms1[TDEFL_MAX_HUFF_SYMBOLS], *pSyms; int num_used_syms = 0; const mz_uint16 *pSym_count = &d->m_huff_count[table_num][0]; for (i = 0; i < table_len; i++) if (pSym_count[i]) { syms0[num_used_syms].m_key = (mz_uint16)pSym_count[i]; syms0[num_used_syms++].m_sym_index = (mz_uint16)i; } pSyms = tdefl_radix_sort_syms(num_used_syms, syms0, syms1); tdefl_calculate_minimum_redundancy(pSyms, num_used_syms); for (i = 0; i < num_used_syms; i++) num_codes[pSyms[i].m_key]++; tdefl_huffman_enforce_max_code_size(num_codes, num_used_syms, code_size_limit); MZ_CLEAR_OBJ(d->m_huff_code_sizes[table_num]); MZ_CLEAR_OBJ(d->m_huff_codes[table_num]); for (i = 1, j = num_used_syms; i <= code_size_limit; i++) for (l = num_codes[i]; l > 0; l--) d->m_huff_code_sizes[table_num][pSyms[--j].m_sym_index] = (mz_uint8)(i); } next_code[1] = 0; for (j = 0, i = 2; i <= code_size_limit; i++) next_code[i] = j = ((j + num_codes[i - 1]) << 1); for (i = 0; i < table_len; i++) { mz_uint rev_code = 0, code, code_size; if ((code_size = d->m_huff_code_sizes[table_num][i]) == 0) continue; code = next_code[code_size]++; for (l = code_size; l > 0; l--, code >>= 1) rev_code = (rev_code << 1) | (code & 1); d->m_huff_codes[table_num][i] = (mz_uint16)rev_code; } } #define TDEFL_PUT_BITS(b, l) do { \ mz_uint bits = b; mz_uint len = l; MZ_ASSERT(bits <= ((1U << len) - 1U)); \ d->m_bit_buffer |= (bits << d->m_bits_in); d->m_bits_in += len; \ while (d->m_bits_in >= 8) { \ if (d->m_pOutput_buf < d->m_pOutput_buf_end) \ *d->m_pOutput_buf++ = (mz_uint8)(d->m_bit_buffer); \ d->m_bit_buffer >>= 8; \ d->m_bits_in -= 8; \ } \ } MZ_MACRO_END #define TDEFL_RLE_PREV_CODE_SIZE() { if (rle_repeat_count) { \ if (rle_repeat_count < 3) { \ d->m_huff_count[2][prev_code_size] = (mz_uint16)(d->m_huff_count[2][prev_code_size] + rle_repeat_count); \ while (rle_repeat_count--) packed_code_sizes[num_packed_code_sizes++] = prev_code_size; \ } else { \ d->m_huff_count[2][16] = (mz_uint16)(d->m_huff_count[2][16] + 1); packed_code_sizes[num_packed_code_sizes++] = 16; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_repeat_count - 3); \ } rle_repeat_count = 0; } } #define TDEFL_RLE_ZERO_CODE_SIZE() { if (rle_z_count) { \ if (rle_z_count < 3) { \ d->m_huff_count[2][0] = (mz_uint16)(d->m_huff_count[2][0] + rle_z_count); while (rle_z_count--) packed_code_sizes[num_packed_code_sizes++] = 0; \ } else if (rle_z_count <= 10) { \ d->m_huff_count[2][17] = (mz_uint16)(d->m_huff_count[2][17] + 1); packed_code_sizes[num_packed_code_sizes++] = 17; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 3); \ } else { \ d->m_huff_count[2][18] = (mz_uint16)(d->m_huff_count[2][18] + 1); packed_code_sizes[num_packed_code_sizes++] = 18; packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 11); \ } rle_z_count = 0; } } static mz_uint8 s_tdefl_packed_code_size_syms_swizzle[] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; static void tdefl_start_dynamic_block(tdefl_compressor *d) { int num_lit_codes, num_dist_codes, num_bit_lengths; mz_uint i, total_code_sizes_to_pack, num_packed_code_sizes, rle_z_count, rle_repeat_count, packed_code_sizes_index; mz_uint8 code_sizes_to_pack[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1], packed_code_sizes[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1], prev_code_size = 0xFF; d->m_huff_count[0][256] = 1; tdefl_optimize_huffman_table(d, 0, TDEFL_MAX_HUFF_SYMBOLS_0, 15, MZ_FALSE); tdefl_optimize_huffman_table(d, 1, TDEFL_MAX_HUFF_SYMBOLS_1, 15, MZ_FALSE); for (num_lit_codes = 286; num_lit_codes > 257; num_lit_codes--) if (d->m_huff_code_sizes[0][num_lit_codes - 1]) break; for (num_dist_codes = 30; num_dist_codes > 1; num_dist_codes--) if (d->m_huff_code_sizes[1][num_dist_codes - 1]) break; memcpy(code_sizes_to_pack, &d->m_huff_code_sizes[0][0], num_lit_codes); memcpy(code_sizes_to_pack + num_lit_codes, &d->m_huff_code_sizes[1][0], num_dist_codes); total_code_sizes_to_pack = num_lit_codes + num_dist_codes; num_packed_code_sizes = 0; rle_z_count = 0; rle_repeat_count = 0; memset(&d->m_huff_count[2][0], 0, sizeof(d->m_huff_count[2][0]) * TDEFL_MAX_HUFF_SYMBOLS_2); for (i = 0; i < total_code_sizes_to_pack; i++) { mz_uint8 code_size = code_sizes_to_pack[i]; if (!code_size) { TDEFL_RLE_PREV_CODE_SIZE(); if (++rle_z_count == 138) { TDEFL_RLE_ZERO_CODE_SIZE(); } } else { TDEFL_RLE_ZERO_CODE_SIZE(); if (code_size != prev_code_size) { TDEFL_RLE_PREV_CODE_SIZE(); d->m_huff_count[2][code_size] = (mz_uint16)(d->m_huff_count[2][code_size] + 1); packed_code_sizes[num_packed_code_sizes++] = code_size; } else if (++rle_repeat_count == 6) { TDEFL_RLE_PREV_CODE_SIZE(); } } prev_code_size = code_size; } if (rle_repeat_count) { TDEFL_RLE_PREV_CODE_SIZE(); } else { TDEFL_RLE_ZERO_CODE_SIZE(); } tdefl_optimize_huffman_table(d, 2, TDEFL_MAX_HUFF_SYMBOLS_2, 7, MZ_FALSE); TDEFL_PUT_BITS(2, 2); TDEFL_PUT_BITS(num_lit_codes - 257, 5); TDEFL_PUT_BITS(num_dist_codes - 1, 5); for (num_bit_lengths = 18; num_bit_lengths >= 0; num_bit_lengths--) if (d->m_huff_code_sizes[2][s_tdefl_packed_code_size_syms_swizzle[num_bit_lengths]]) break; num_bit_lengths = MZ_MAX(4, (num_bit_lengths + 1)); TDEFL_PUT_BITS(num_bit_lengths - 4, 4); for (i = 0; (int)i < num_bit_lengths; i++) TDEFL_PUT_BITS(d->m_huff_code_sizes[2][s_tdefl_packed_code_size_syms_swizzle[i]], 3); for (packed_code_sizes_index = 0; packed_code_sizes_index < num_packed_code_sizes; ) { mz_uint code = packed_code_sizes[packed_code_sizes_index++]; MZ_ASSERT(code < TDEFL_MAX_HUFF_SYMBOLS_2); TDEFL_PUT_BITS(d->m_huff_codes[2][code], d->m_huff_code_sizes[2][code]); if (code >= 16) TDEFL_PUT_BITS(packed_code_sizes[packed_code_sizes_index++], "\02\03\07"[code - 16]); } } static void tdefl_start_static_block(tdefl_compressor *d) { mz_uint i; mz_uint8 *p = &d->m_huff_code_sizes[0][0]; for (i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8; memset(d->m_huff_code_sizes[1], 5, 32); tdefl_optimize_huffman_table(d, 0, 288, 15, MZ_TRUE); tdefl_optimize_huffman_table(d, 1, 32, 15, MZ_TRUE); TDEFL_PUT_BITS(1, 2); } static const mz_uint mz_bitmasks[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) { mz_uint flags; mz_uint8 *pLZ_codes; mz_uint8 *pOutput_buf = d->m_pOutput_buf; mz_uint8 *pLZ_code_buf_end = d->m_pLZ_code_buf; mz_uint64 bit_buffer = d->m_bit_buffer; mz_uint bits_in = d->m_bits_in; #define TDEFL_PUT_BITS_FAST(b, l) { bit_buffer |= (((mz_uint64)(b)) << bits_in); bits_in += (l); } flags = 1; for (pLZ_codes = d->m_lz_code_buf; pLZ_codes < pLZ_code_buf_end; flags >>= 1) { if (flags == 1) flags = *pLZ_codes++ | 0x100; if (flags & 1) { mz_uint s0, s1, n0, n1, sym, num_extra_bits; mz_uint match_len = pLZ_codes[0], match_dist = *(const mz_uint16 *)(pLZ_codes + 1); pLZ_codes += 3; MZ_ASSERT(d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][s_tdefl_len_sym[match_len]], d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); TDEFL_PUT_BITS_FAST(match_len & mz_bitmasks[s_tdefl_len_extra[match_len]], s_tdefl_len_extra[match_len]); // This sequence coaxes MSVC into using cmov's vs. jmp's. s0 = s_tdefl_small_dist_sym[match_dist & 511]; n0 = s_tdefl_small_dist_extra[match_dist & 511]; s1 = s_tdefl_large_dist_sym[match_dist >> 8]; n1 = s_tdefl_large_dist_extra[match_dist >> 8]; sym = (match_dist < 512) ? s0 : s1; num_extra_bits = (match_dist < 512) ? n0 : n1; MZ_ASSERT(d->m_huff_code_sizes[1][sym]); TDEFL_PUT_BITS_FAST(d->m_huff_codes[1][sym], d->m_huff_code_sizes[1][sym]); TDEFL_PUT_BITS_FAST(match_dist & mz_bitmasks[num_extra_bits], num_extra_bits); } else { mz_uint lit = *pLZ_codes++; MZ_ASSERT(d->m_huff_code_sizes[0][lit]); TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]); if (((flags & 2) == 0) && (pLZ_codes < pLZ_code_buf_end)) { flags >>= 1; lit = *pLZ_codes++; MZ_ASSERT(d->m_huff_code_sizes[0][lit]); TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]); if (((flags & 2) == 0) && (pLZ_codes < pLZ_code_buf_end)) { flags >>= 1; lit = *pLZ_codes++; MZ_ASSERT(d->m_huff_code_sizes[0][lit]); TDEFL_PUT_BITS_FAST(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]); } } } if (pOutput_buf >= d->m_pOutput_buf_end) return MZ_FALSE; *(mz_uint64*)pOutput_buf = bit_buffer; pOutput_buf += (bits_in >> 3); bit_buffer >>= (bits_in & ~7); bits_in &= 7; } #undef TDEFL_PUT_BITS_FAST d->m_pOutput_buf = pOutput_buf; d->m_bits_in = 0; d->m_bit_buffer = 0; while (bits_in) { mz_uint32 n = MZ_MIN(bits_in, 16); TDEFL_PUT_BITS((mz_uint)bit_buffer & mz_bitmasks[n], n); bit_buffer >>= n; bits_in -= n; } TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]); return (d->m_pOutput_buf < d->m_pOutput_buf_end); } #else static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) { mz_uint flags; mz_uint8 *pLZ_codes; flags = 1; for (pLZ_codes = d->m_lz_code_buf; pLZ_codes < d->m_pLZ_code_buf; flags >>= 1) { if (flags == 1) flags = *pLZ_codes++ | 0x100; if (flags & 1) { mz_uint sym, num_extra_bits; mz_uint match_len = pLZ_codes[0], match_dist = (pLZ_codes[1] | (pLZ_codes[2] << 8)); pLZ_codes += 3; MZ_ASSERT(d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); TDEFL_PUT_BITS(d->m_huff_codes[0][s_tdefl_len_sym[match_len]], d->m_huff_code_sizes[0][s_tdefl_len_sym[match_len]]); TDEFL_PUT_BITS(match_len & mz_bitmasks[s_tdefl_len_extra[match_len]], s_tdefl_len_extra[match_len]); if (match_dist < 512) { sym = s_tdefl_small_dist_sym[match_dist]; num_extra_bits = s_tdefl_small_dist_extra[match_dist]; } else { sym = s_tdefl_large_dist_sym[match_dist >> 8]; num_extra_bits = s_tdefl_large_dist_extra[match_dist >> 8]; } MZ_ASSERT(d->m_huff_code_sizes[1][sym]); TDEFL_PUT_BITS(d->m_huff_codes[1][sym], d->m_huff_code_sizes[1][sym]); TDEFL_PUT_BITS(match_dist & mz_bitmasks[num_extra_bits], num_extra_bits); } else { mz_uint lit = *pLZ_codes++; MZ_ASSERT(d->m_huff_code_sizes[0][lit]); TDEFL_PUT_BITS(d->m_huff_codes[0][lit], d->m_huff_code_sizes[0][lit]); } } TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]); return (d->m_pOutput_buf < d->m_pOutput_buf_end); } #endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS static mz_bool tdefl_compress_block(tdefl_compressor *d, mz_bool static_block) { if (static_block) tdefl_start_static_block(d); else tdefl_start_dynamic_block(d); return tdefl_compress_lz_codes(d); } static int tdefl_flush_block(tdefl_compressor *d, int flush) { mz_uint saved_bit_buf, saved_bits_in; mz_uint8 *pSaved_output_buf; mz_bool comp_block_succeeded = MZ_FALSE; int n, use_raw_block = ((d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS) != 0) && (d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size; mz_uint8 *pOutput_buf_start = ((d->m_pPut_buf_func == NULL) && ((*d->m_pOut_buf_size - d->m_out_buf_ofs) >= TDEFL_OUT_BUF_SIZE)) ? ((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs) : d->m_output_buf; d->m_pOutput_buf = pOutput_buf_start; d->m_pOutput_buf_end = d->m_pOutput_buf + TDEFL_OUT_BUF_SIZE - 16; MZ_ASSERT(!d->m_output_flush_remaining); d->m_output_flush_ofs = 0; d->m_output_flush_remaining = 0; *d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> d->m_num_flags_left); d->m_pLZ_code_buf -= (d->m_num_flags_left == 8); if ((d->m_flags & TDEFL_WRITE_ZLIB_HEADER) && (!d->m_block_index)) { TDEFL_PUT_BITS(0x78, 8); TDEFL_PUT_BITS(0x01, 8); } TDEFL_PUT_BITS(flush == TDEFL_FINISH, 1); pSaved_output_buf = d->m_pOutput_buf; saved_bit_buf = d->m_bit_buffer; saved_bits_in = d->m_bits_in; if (!use_raw_block) comp_block_succeeded = tdefl_compress_block(d, (d->m_flags & TDEFL_FORCE_ALL_STATIC_BLOCKS) || (d->m_total_lz_bytes < 48)); // If the block gets expanded, forget the current contents of the output buffer and send a raw block instead. if ( ((use_raw_block) || ((d->m_total_lz_bytes) && ((d->m_pOutput_buf - pSaved_output_buf + 1U) >= d->m_total_lz_bytes))) && ((d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size) ) { mz_uint i; d->m_pOutput_buf = pSaved_output_buf; d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in; TDEFL_PUT_BITS(0, 2); if (d->m_bits_in) { TDEFL_PUT_BITS(0, 8 - d->m_bits_in); } for (i = 2; i; --i, d->m_total_lz_bytes ^= 0xFFFF) { TDEFL_PUT_BITS(d->m_total_lz_bytes & 0xFFFF, 16); } for (i = 0; i < d->m_total_lz_bytes; ++i) { TDEFL_PUT_BITS(d->m_dict[(d->m_lz_code_buf_dict_pos + i) & TDEFL_LZ_DICT_SIZE_MASK], 8); } } // Check for the extremely unlikely (if not impossible) case of the compressed block not fitting into the output buffer when using dynamic codes. else if (!comp_block_succeeded) { d->m_pOutput_buf = pSaved_output_buf; d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in; tdefl_compress_block(d, MZ_TRUE); } if (flush) { if (flush == TDEFL_FINISH) { if (d->m_bits_in) { TDEFL_PUT_BITS(0, 8 - d->m_bits_in); } if (d->m_flags & TDEFL_WRITE_ZLIB_HEADER) { mz_uint i, a = d->m_adler32; for (i = 0; i < 4; i++) { TDEFL_PUT_BITS((a >> 24) & 0xFF, 8); a <<= 8; } } } else { mz_uint i, z = 0; TDEFL_PUT_BITS(0, 3); if (d->m_bits_in) { TDEFL_PUT_BITS(0, 8 - d->m_bits_in); } for (i = 2; i; --i, z ^= 0xFFFF) { TDEFL_PUT_BITS(z & 0xFFFF, 16); } } } MZ_ASSERT(d->m_pOutput_buf < d->m_pOutput_buf_end); memset(&d->m_huff_count[0][0], 0, sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0); memset(&d->m_huff_count[1][0], 0, sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1); d->m_pLZ_code_buf = d->m_lz_code_buf + 1; d->m_pLZ_flags = d->m_lz_code_buf; d->m_num_flags_left = 8; d->m_lz_code_buf_dict_pos += d->m_total_lz_bytes; d->m_total_lz_bytes = 0; d->m_block_index++; if ((n = (int)(d->m_pOutput_buf - pOutput_buf_start)) != 0) { if (d->m_pPut_buf_func) { *d->m_pIn_buf_size = d->m_pSrc - (const mz_uint8 *)d->m_pIn_buf; if (!(*d->m_pPut_buf_func)(d->m_output_buf, n, d->m_pPut_buf_user)) return (d->m_prev_return_status = TDEFL_STATUS_PUT_BUF_FAILED); } else if (pOutput_buf_start == d->m_output_buf) { int bytes_to_copy = (int)MZ_MIN((size_t)n, (size_t)(*d->m_pOut_buf_size - d->m_out_buf_ofs)); memcpy((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, d->m_output_buf, bytes_to_copy); d->m_out_buf_ofs += bytes_to_copy; if ((n -= bytes_to_copy) != 0) { d->m_output_flush_ofs = bytes_to_copy; d->m_output_flush_remaining = n; } } else { d->m_out_buf_ofs += n; } } return d->m_output_flush_remaining; } #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES #define TDEFL_READ_UNALIGNED_WORD(p) *(const mz_uint16*)(p) static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahead_pos, mz_uint max_dist, mz_uint max_match_len, mz_uint *pMatch_dist, mz_uint *pMatch_len) { mz_uint dist, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, match_len = *pMatch_len, probe_pos = pos, next_probe_pos, probe_len; mz_uint num_probes_left = d->m_max_probes[match_len >= 32]; const mz_uint16 *s = (const mz_uint16*)(d->m_dict + pos), *p, *q; mz_uint16 c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]), s01 = TDEFL_READ_UNALIGNED_WORD(s); MZ_ASSERT(max_match_len <= TDEFL_MAX_MATCH_LEN); if (max_match_len <= match_len) return; for ( ; ; ) { for ( ; ; ) { if (--num_probes_left == 0) return; #define TDEFL_PROBE \ next_probe_pos = d->m_next[probe_pos]; \ if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) return; \ probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \ if (TDEFL_READ_UNALIGNED_WORD(&d->m_dict[probe_pos + match_len - 1]) == c01) break; TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE; } if (!dist) break; q = (const mz_uint16*)(d->m_dict + probe_pos); if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; p = s; probe_len = 32; do { } while ( (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (--probe_len > 0) ); if (!probe_len) { *pMatch_dist = dist; *pMatch_len = MZ_MIN(max_match_len, TDEFL_MAX_MATCH_LEN); break; } else if ((probe_len = ((mz_uint)(p - s) * 2) + (mz_uint)(*(const mz_uint8*)p == *(const mz_uint8*)q)) > match_len) { *pMatch_dist = dist; if ((*pMatch_len = match_len = MZ_MIN(max_match_len, probe_len)) == max_match_len) break; c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]); } } } #else static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahead_pos, mz_uint max_dist, mz_uint max_match_len, mz_uint *pMatch_dist, mz_uint *pMatch_len) { mz_uint dist, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, match_len = *pMatch_len, probe_pos = pos, next_probe_pos, probe_len; mz_uint num_probes_left = d->m_max_probes[match_len >= 32]; const mz_uint8 *s = d->m_dict + pos, *p, *q; mz_uint8 c0 = d->m_dict[pos + match_len], c1 = d->m_dict[pos + match_len - 1]; MZ_ASSERT(max_match_len <= TDEFL_MAX_MATCH_LEN); if (max_match_len <= match_len) return; for ( ; ; ) { for ( ; ; ) { if (--num_probes_left == 0) return; #define TDEFL_PROBE \ next_probe_pos = d->m_next[probe_pos]; \ if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) return; \ probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \ if ((d->m_dict[probe_pos + match_len] == c0) && (d->m_dict[probe_pos + match_len - 1] == c1)) break; TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE; } if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break; if (probe_len > match_len) { *pMatch_dist = dist; if ((*pMatch_len = match_len = probe_len) == max_match_len) return; c0 = d->m_dict[pos + match_len]; c1 = d->m_dict[pos + match_len - 1]; } } } #endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN static mz_bool tdefl_compress_fast(tdefl_compressor *d) { // Faster, minimally featured LZRW1-style match+parse loop with better register utilization. Intended for applications where raw throughput is valued more highly than ratio. mz_uint lookahead_pos = d->m_lookahead_pos, lookahead_size = d->m_lookahead_size, dict_size = d->m_dict_size, total_lz_bytes = d->m_total_lz_bytes, num_flags_left = d->m_num_flags_left; mz_uint8 *pLZ_code_buf = d->m_pLZ_code_buf, *pLZ_flags = d->m_pLZ_flags; mz_uint cur_pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK; while ((d->m_src_buf_left) || ((d->m_flush) && (lookahead_size))) { const mz_uint TDEFL_COMP_FAST_LOOKAHEAD_SIZE = 4096; mz_uint dst_pos = (lookahead_pos + lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK; mz_uint num_bytes_to_process = (mz_uint)MZ_MIN(d->m_src_buf_left, TDEFL_COMP_FAST_LOOKAHEAD_SIZE - lookahead_size); d->m_src_buf_left -= num_bytes_to_process; lookahead_size += num_bytes_to_process; while (num_bytes_to_process) { mz_uint32 n = MZ_MIN(TDEFL_LZ_DICT_SIZE - dst_pos, num_bytes_to_process); memcpy(d->m_dict + dst_pos, d->m_pSrc, n); if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) memcpy(d->m_dict + TDEFL_LZ_DICT_SIZE + dst_pos, d->m_pSrc, MZ_MIN(n, (TDEFL_MAX_MATCH_LEN - 1) - dst_pos)); d->m_pSrc += n; dst_pos = (dst_pos + n) & TDEFL_LZ_DICT_SIZE_MASK; num_bytes_to_process -= n; } dict_size = MZ_MIN(TDEFL_LZ_DICT_SIZE - lookahead_size, dict_size); if ((!d->m_flush) && (lookahead_size < TDEFL_COMP_FAST_LOOKAHEAD_SIZE)) break; while (lookahead_size >= 4) { mz_uint cur_match_dist, cur_match_len = 1; mz_uint8 *pCur_dict = d->m_dict + cur_pos; mz_uint first_trigram = (*(const mz_uint32 *)pCur_dict) & 0xFFFFFF; mz_uint hash = (first_trigram ^ (first_trigram >> (24 - (TDEFL_LZ_HASH_BITS - 8)))) & TDEFL_LEVEL1_HASH_SIZE_MASK; mz_uint probe_pos = d->m_hash[hash]; d->m_hash[hash] = (mz_uint16)lookahead_pos; if (((cur_match_dist = (mz_uint16)(lookahead_pos - probe_pos)) <= dict_size) && ((*(const mz_uint32 *)(d->m_dict + (probe_pos &= TDEFL_LZ_DICT_SIZE_MASK)) & 0xFFFFFF) == first_trigram)) { const mz_uint16 *p = (const mz_uint16 *)pCur_dict; const mz_uint16 *q = (const mz_uint16 *)(d->m_dict + probe_pos); mz_uint32 probe_len = 32; do { } while ( (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (--probe_len > 0) ); cur_match_len = ((mz_uint)(p - (const mz_uint16 *)pCur_dict) * 2) + (mz_uint)(*(const mz_uint8 *)p == *(const mz_uint8 *)q); if (!probe_len) cur_match_len = cur_match_dist ? TDEFL_MAX_MATCH_LEN : 0; if ((cur_match_len < TDEFL_MIN_MATCH_LEN) || ((cur_match_len == TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 8U*1024U))) { cur_match_len = 1; *pLZ_code_buf++ = (mz_uint8)first_trigram; *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1); d->m_huff_count[0][(mz_uint8)first_trigram]++; } else { mz_uint32 s0, s1; cur_match_len = MZ_MIN(cur_match_len, lookahead_size); MZ_ASSERT((cur_match_len >= TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 1) && (cur_match_dist <= TDEFL_LZ_DICT_SIZE)); cur_match_dist--; pLZ_code_buf[0] = (mz_uint8)(cur_match_len - TDEFL_MIN_MATCH_LEN); *(mz_uint16 *)(&pLZ_code_buf[1]) = (mz_uint16)cur_match_dist; pLZ_code_buf += 3; *pLZ_flags = (mz_uint8)((*pLZ_flags >> 1) | 0x80); s0 = s_tdefl_small_dist_sym[cur_match_dist & 511]; s1 = s_tdefl_large_dist_sym[cur_match_dist >> 8]; d->m_huff_count[1][(cur_match_dist < 512) ? s0 : s1]++; d->m_huff_count[0][s_tdefl_len_sym[cur_match_len - TDEFL_MIN_MATCH_LEN]]++; } } else { *pLZ_code_buf++ = (mz_uint8)first_trigram; *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1); d->m_huff_count[0][(mz_uint8)first_trigram]++; } if (--num_flags_left == 0) { num_flags_left = 8; pLZ_flags = pLZ_code_buf++; } total_lz_bytes += cur_match_len; lookahead_pos += cur_match_len; dict_size = MZ_MIN(dict_size + cur_match_len, TDEFL_LZ_DICT_SIZE); cur_pos = (cur_pos + cur_match_len) & TDEFL_LZ_DICT_SIZE_MASK; MZ_ASSERT(lookahead_size >= cur_match_len); lookahead_size -= cur_match_len; if (pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) { int n; d->m_lookahead_pos = lookahead_pos; d->m_lookahead_size = lookahead_size; d->m_dict_size = dict_size; d->m_total_lz_bytes = total_lz_bytes; d->m_pLZ_code_buf = pLZ_code_buf; d->m_pLZ_flags = pLZ_flags; d->m_num_flags_left = num_flags_left; if ((n = tdefl_flush_block(d, 0)) != 0) return (n < 0) ? MZ_FALSE : MZ_TRUE; total_lz_bytes = d->m_total_lz_bytes; pLZ_code_buf = d->m_pLZ_code_buf; pLZ_flags = d->m_pLZ_flags; num_flags_left = d->m_num_flags_left; } } while (lookahead_size) { mz_uint8 lit = d->m_dict[cur_pos]; total_lz_bytes++; *pLZ_code_buf++ = lit; *pLZ_flags = (mz_uint8)(*pLZ_flags >> 1); if (--num_flags_left == 0) { num_flags_left = 8; pLZ_flags = pLZ_code_buf++; } d->m_huff_count[0][lit]++; lookahead_pos++; dict_size = MZ_MIN(dict_size + 1, TDEFL_LZ_DICT_SIZE); cur_pos = (cur_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK; lookahead_size--; if (pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) { int n; d->m_lookahead_pos = lookahead_pos; d->m_lookahead_size = lookahead_size; d->m_dict_size = dict_size; d->m_total_lz_bytes = total_lz_bytes; d->m_pLZ_code_buf = pLZ_code_buf; d->m_pLZ_flags = pLZ_flags; d->m_num_flags_left = num_flags_left; if ((n = tdefl_flush_block(d, 0)) != 0) return (n < 0) ? MZ_FALSE : MZ_TRUE; total_lz_bytes = d->m_total_lz_bytes; pLZ_code_buf = d->m_pLZ_code_buf; pLZ_flags = d->m_pLZ_flags; num_flags_left = d->m_num_flags_left; } } } d->m_lookahead_pos = lookahead_pos; d->m_lookahead_size = lookahead_size; d->m_dict_size = dict_size; d->m_total_lz_bytes = total_lz_bytes; d->m_pLZ_code_buf = pLZ_code_buf; d->m_pLZ_flags = pLZ_flags; d->m_num_flags_left = num_flags_left; return MZ_TRUE; } #endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN static MZ_FORCEINLINE void tdefl_record_literal(tdefl_compressor *d, mz_uint8 lit) { d->m_total_lz_bytes++; *d->m_pLZ_code_buf++ = lit; *d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> 1); if (--d->m_num_flags_left == 0) { d->m_num_flags_left = 8; d->m_pLZ_flags = d->m_pLZ_code_buf++; } d->m_huff_count[0][lit]++; } static MZ_FORCEINLINE void tdefl_record_match(tdefl_compressor *d, mz_uint match_len, mz_uint match_dist) { mz_uint32 s0, s1; MZ_ASSERT((match_len >= TDEFL_MIN_MATCH_LEN) && (match_dist >= 1) && (match_dist <= TDEFL_LZ_DICT_SIZE)); d->m_total_lz_bytes += match_len; d->m_pLZ_code_buf[0] = (mz_uint8)(match_len - TDEFL_MIN_MATCH_LEN); match_dist -= 1; d->m_pLZ_code_buf[1] = (mz_uint8)(match_dist & 0xFF); d->m_pLZ_code_buf[2] = (mz_uint8)(match_dist >> 8); d->m_pLZ_code_buf += 3; *d->m_pLZ_flags = (mz_uint8)((*d->m_pLZ_flags >> 1) | 0x80); if (--d->m_num_flags_left == 0) { d->m_num_flags_left = 8; d->m_pLZ_flags = d->m_pLZ_code_buf++; } s0 = s_tdefl_small_dist_sym[match_dist & 511]; s1 = s_tdefl_large_dist_sym[(match_dist >> 8) & 127]; d->m_huff_count[1][(match_dist < 512) ? s0 : s1]++; if (match_len >= TDEFL_MIN_MATCH_LEN) d->m_huff_count[0][s_tdefl_len_sym[match_len - TDEFL_MIN_MATCH_LEN]]++; } static mz_bool tdefl_compress_normal(tdefl_compressor *d) { const mz_uint8 *pSrc = d->m_pSrc; size_t src_buf_left = d->m_src_buf_left; tdefl_flush flush = d->m_flush; while ((src_buf_left) || ((flush) && (d->m_lookahead_size))) { mz_uint len_to_move, cur_match_dist, cur_match_len, cur_pos; // Update dictionary and hash chains. Keeps the lookahead size equal to TDEFL_MAX_MATCH_LEN. if ((d->m_lookahead_size + d->m_dict_size) >= (TDEFL_MIN_MATCH_LEN - 1)) { mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK, ins_pos = d->m_lookahead_pos + d->m_lookahead_size - 2; mz_uint hash = (d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] << TDEFL_LZ_HASH_SHIFT) ^ d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK]; mz_uint num_bytes_to_process = (mz_uint)MZ_MIN(src_buf_left, TDEFL_MAX_MATCH_LEN - d->m_lookahead_size); const mz_uint8 *pSrc_end = pSrc + num_bytes_to_process; src_buf_left -= num_bytes_to_process; d->m_lookahead_size += num_bytes_to_process; while (pSrc != pSrc_end) { mz_uint8 c = *pSrc++; d->m_dict[dst_pos] = c; if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c; hash = ((hash << TDEFL_LZ_HASH_SHIFT) ^ c) & (TDEFL_LZ_HASH_SIZE - 1); d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; d->m_hash[hash] = (mz_uint16)(ins_pos); dst_pos = (dst_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK; ins_pos++; } } else { while ((src_buf_left) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN)) { mz_uint8 c = *pSrc++; mz_uint dst_pos = (d->m_lookahead_pos + d->m_lookahead_size) & TDEFL_LZ_DICT_SIZE_MASK; src_buf_left--; d->m_dict[dst_pos] = c; if (dst_pos < (TDEFL_MAX_MATCH_LEN - 1)) d->m_dict[TDEFL_LZ_DICT_SIZE + dst_pos] = c; if ((++d->m_lookahead_size + d->m_dict_size) >= TDEFL_MIN_MATCH_LEN) { mz_uint ins_pos = d->m_lookahead_pos + (d->m_lookahead_size - 1) - 2; mz_uint hash = ((d->m_dict[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] << (TDEFL_LZ_HASH_SHIFT * 2)) ^ (d->m_dict[(ins_pos + 1) & TDEFL_LZ_DICT_SIZE_MASK] << TDEFL_LZ_HASH_SHIFT) ^ c) & (TDEFL_LZ_HASH_SIZE - 1); d->m_next[ins_pos & TDEFL_LZ_DICT_SIZE_MASK] = d->m_hash[hash]; d->m_hash[hash] = (mz_uint16)(ins_pos); } } } d->m_dict_size = MZ_MIN(TDEFL_LZ_DICT_SIZE - d->m_lookahead_size, d->m_dict_size); if ((!flush) && (d->m_lookahead_size < TDEFL_MAX_MATCH_LEN)) break; // Simple lazy/greedy parsing state machine. len_to_move = 1; cur_match_dist = 0; cur_match_len = d->m_saved_match_len ? d->m_saved_match_len : (TDEFL_MIN_MATCH_LEN - 1); cur_pos = d->m_lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK; if (d->m_flags & (TDEFL_RLE_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS)) { if ((d->m_dict_size) && (!(d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS))) { mz_uint8 c = d->m_dict[(cur_pos - 1) & TDEFL_LZ_DICT_SIZE_MASK]; cur_match_len = 0; while (cur_match_len < d->m_lookahead_size) { if (d->m_dict[cur_pos + cur_match_len] != c) break; cur_match_len++; } if (cur_match_len < TDEFL_MIN_MATCH_LEN) cur_match_len = 0; else cur_match_dist = 1; } } else { tdefl_find_match(d, d->m_lookahead_pos, d->m_dict_size, d->m_lookahead_size, &cur_match_dist, &cur_match_len); } if (((cur_match_len == TDEFL_MIN_MATCH_LEN) && (cur_match_dist >= 8U*1024U)) || (cur_pos == cur_match_dist) || ((d->m_flags & TDEFL_FILTER_MATCHES) && (cur_match_len <= 5))) { cur_match_dist = cur_match_len = 0; } if (d->m_saved_match_len) { if (cur_match_len > d->m_saved_match_len) { tdefl_record_literal(d, (mz_uint8)d->m_saved_lit); if (cur_match_len >= 128) { tdefl_record_match(d, cur_match_len, cur_match_dist); d->m_saved_match_len = 0; len_to_move = cur_match_len; } else { d->m_saved_lit = d->m_dict[cur_pos]; d->m_saved_match_dist = cur_match_dist; d->m_saved_match_len = cur_match_len; } } else { tdefl_record_match(d, d->m_saved_match_len, d->m_saved_match_dist); len_to_move = d->m_saved_match_len - 1; d->m_saved_match_len = 0; } } else if (!cur_match_dist) tdefl_record_literal(d, d->m_dict[MZ_MIN(cur_pos, sizeof(d->m_dict) - 1)]); else if ((d->m_greedy_parsing) || (d->m_flags & TDEFL_RLE_MATCHES) || (cur_match_len >= 128)) { tdefl_record_match(d, cur_match_len, cur_match_dist); len_to_move = cur_match_len; } else { d->m_saved_lit = d->m_dict[MZ_MIN(cur_pos, sizeof(d->m_dict) - 1)]; d->m_saved_match_dist = cur_match_dist; d->m_saved_match_len = cur_match_len; } // Move the lookahead forward by len_to_move bytes. d->m_lookahead_pos += len_to_move; MZ_ASSERT(d->m_lookahead_size >= len_to_move); d->m_lookahead_size -= len_to_move; d->m_dict_size = MZ_MIN(d->m_dict_size + len_to_move, TDEFL_LZ_DICT_SIZE); // Check if it's time to flush the current LZ codes to the internal output buffer. if ( (d->m_pLZ_code_buf > &d->m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE - 8]) || ( (d->m_total_lz_bytes > 31*1024) && (((((mz_uint)(d->m_pLZ_code_buf - d->m_lz_code_buf) * 115) >> 7) >= d->m_total_lz_bytes) || (d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS))) ) { int n; d->m_pSrc = pSrc; d->m_src_buf_left = src_buf_left; if ((n = tdefl_flush_block(d, 0)) != 0) return (n < 0) ? MZ_FALSE : MZ_TRUE; } } d->m_pSrc = pSrc; d->m_src_buf_left = src_buf_left; return MZ_TRUE; } static tdefl_status tdefl_flush_output_buffer(tdefl_compressor *d) { if (d->m_pIn_buf_size) { *d->m_pIn_buf_size = d->m_pSrc - (const mz_uint8 *)d->m_pIn_buf; } if (d->m_pOut_buf_size) { size_t n = MZ_MIN(*d->m_pOut_buf_size - d->m_out_buf_ofs, d->m_output_flush_remaining); memcpy((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, d->m_output_buf + d->m_output_flush_ofs, n); d->m_output_flush_ofs += (mz_uint)n; d->m_output_flush_remaining -= (mz_uint)n; d->m_out_buf_ofs += n; *d->m_pOut_buf_size = d->m_out_buf_ofs; } return (d->m_finished && !d->m_output_flush_remaining) ? TDEFL_STATUS_DONE : TDEFL_STATUS_OKAY; } tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush) { if (!d) { if (pIn_buf_size) *pIn_buf_size = 0; if (pOut_buf_size) *pOut_buf_size = 0; return TDEFL_STATUS_BAD_PARAM; } d->m_pIn_buf = pIn_buf; d->m_pIn_buf_size = pIn_buf_size; d->m_pOut_buf = pOut_buf; d->m_pOut_buf_size = pOut_buf_size; d->m_pSrc = (const mz_uint8 *)(pIn_buf); d->m_src_buf_left = pIn_buf_size ? *pIn_buf_size : 0; d->m_out_buf_ofs = 0; d->m_flush = flush; if ( ((d->m_pPut_buf_func != NULL) == ((pOut_buf != NULL) || (pOut_buf_size != NULL))) || (d->m_prev_return_status != TDEFL_STATUS_OKAY) || (d->m_wants_to_finish && (flush != TDEFL_FINISH)) || (pIn_buf_size && *pIn_buf_size && !pIn_buf) || (pOut_buf_size && *pOut_buf_size && !pOut_buf) ) { if (pIn_buf_size) *pIn_buf_size = 0; if (pOut_buf_size) *pOut_buf_size = 0; return (d->m_prev_return_status = TDEFL_STATUS_BAD_PARAM); } d->m_wants_to_finish |= (flush == TDEFL_FINISH); if ((d->m_output_flush_remaining) || (d->m_finished)) return (d->m_prev_return_status = tdefl_flush_output_buffer(d)); #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN if (((d->m_flags & TDEFL_MAX_PROBES_MASK) == 1) && ((d->m_flags & TDEFL_GREEDY_PARSING_FLAG) != 0) && ((d->m_flags & (TDEFL_FILTER_MATCHES | TDEFL_FORCE_ALL_RAW_BLOCKS | TDEFL_RLE_MATCHES)) == 0)) { if (!tdefl_compress_fast(d)) return d->m_prev_return_status; } else #endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN { if (!tdefl_compress_normal(d)) return d->m_prev_return_status; } if ((d->m_flags & (TDEFL_WRITE_ZLIB_HEADER | TDEFL_COMPUTE_ADLER32)) && (pIn_buf)) d->m_adler32 = (mz_uint32)mz_adler32(d->m_adler32, (const mz_uint8 *)pIn_buf, d->m_pSrc - (const mz_uint8 *)pIn_buf); if ((flush) && (!d->m_lookahead_size) && (!d->m_src_buf_left) && (!d->m_output_flush_remaining)) { if (tdefl_flush_block(d, flush) < 0) return d->m_prev_return_status; d->m_finished = (flush == TDEFL_FINISH); if (flush == TDEFL_FULL_FLUSH) { MZ_CLEAR_OBJ(d->m_hash); MZ_CLEAR_OBJ(d->m_next); d->m_dict_size = 0; } } return (d->m_prev_return_status = tdefl_flush_output_buffer(d)); } tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush) { MZ_ASSERT(d->m_pPut_buf_func); return tdefl_compress(d, pIn_buf, &in_buf_size, NULL, NULL, flush); } tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags) { d->m_pPut_buf_func = pPut_buf_func; d->m_pPut_buf_user = pPut_buf_user; d->m_flags = (mz_uint)(flags); d->m_max_probes[0] = 1 + ((flags & 0xFFF) + 2) / 3; d->m_greedy_parsing = (flags & TDEFL_GREEDY_PARSING_FLAG) != 0; d->m_max_probes[1] = 1 + (((flags & 0xFFF) >> 2) + 2) / 3; if (!(flags & TDEFL_NONDETERMINISTIC_PARSING_FLAG)) MZ_CLEAR_OBJ(d->m_hash); d->m_lookahead_pos = d->m_lookahead_size = d->m_dict_size = d->m_total_lz_bytes = d->m_lz_code_buf_dict_pos = d->m_bits_in = 0; d->m_output_flush_ofs = d->m_output_flush_remaining = d->m_finished = d->m_block_index = d->m_bit_buffer = d->m_wants_to_finish = 0; d->m_pLZ_code_buf = d->m_lz_code_buf + 1; d->m_pLZ_flags = d->m_lz_code_buf; d->m_num_flags_left = 8; d->m_pOutput_buf = d->m_output_buf; d->m_pOutput_buf_end = d->m_output_buf; d->m_prev_return_status = TDEFL_STATUS_OKAY; d->m_saved_match_dist = d->m_saved_match_len = d->m_saved_lit = 0; d->m_adler32 = 1; d->m_pIn_buf = NULL; d->m_pOut_buf = NULL; d->m_pIn_buf_size = NULL; d->m_pOut_buf_size = NULL; d->m_flush = TDEFL_NO_FLUSH; d->m_pSrc = NULL; d->m_src_buf_left = 0; d->m_out_buf_ofs = 0; memset(&d->m_huff_count[0][0], 0, sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0); memset(&d->m_huff_count[1][0], 0, sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1); return TDEFL_STATUS_OKAY; } tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d) { return d->m_prev_return_status; } mz_uint32 tdefl_get_adler32(tdefl_compressor *d) { return d->m_adler32; } mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags) { tdefl_compressor *pComp; mz_bool succeeded; if (((buf_len) && (!pBuf)) || (!pPut_buf_func)) return MZ_FALSE; pComp = (tdefl_compressor*)MZ_MALLOC(sizeof(tdefl_compressor)); if (!pComp) return MZ_FALSE; succeeded = (tdefl_init(pComp, pPut_buf_func, pPut_buf_user, flags) == TDEFL_STATUS_OKAY); succeeded = succeeded && (tdefl_compress_buffer(pComp, pBuf, buf_len, TDEFL_FINISH) == TDEFL_STATUS_DONE); MZ_FREE(pComp); return succeeded; } typedef struct { size_t m_size, m_capacity; mz_uint8 *m_pBuf; mz_bool m_expandable; } tdefl_output_buffer; static mz_bool tdefl_output_buffer_putter(const void *pBuf, int len, void *pUser) { tdefl_output_buffer *p = (tdefl_output_buffer *)pUser; size_t new_size = p->m_size + len; if (new_size > p->m_capacity) { size_t new_capacity = p->m_capacity; mz_uint8 *pNew_buf; if (!p->m_expandable) return MZ_FALSE; do { new_capacity = MZ_MAX(128U, new_capacity << 1U); } while (new_size > new_capacity); pNew_buf = (mz_uint8*)MZ_REALLOC(p->m_pBuf, new_capacity); if (!pNew_buf) return MZ_FALSE; p->m_pBuf = pNew_buf; p->m_capacity = new_capacity; } memcpy((mz_uint8*)p->m_pBuf + p->m_size, pBuf, len); p->m_size = new_size; return MZ_TRUE; } void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags) { tdefl_output_buffer out_buf; MZ_CLEAR_OBJ(out_buf); if (!pOut_len) return MZ_FALSE; else *pOut_len = 0; out_buf.m_expandable = MZ_TRUE; if (!tdefl_compress_mem_to_output(pSrc_buf, src_buf_len, tdefl_output_buffer_putter, &out_buf, flags)) return NULL; *pOut_len = out_buf.m_size; return out_buf.m_pBuf; } size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags) { tdefl_output_buffer out_buf; MZ_CLEAR_OBJ(out_buf); if (!pOut_buf) return 0; out_buf.m_pBuf = (mz_uint8*)pOut_buf; out_buf.m_capacity = out_buf_len; if (!tdefl_compress_mem_to_output(pSrc_buf, src_buf_len, tdefl_output_buffer_putter, &out_buf, flags)) return 0; return out_buf.m_size; } #ifndef MINIZ_NO_ZLIB_APIS static const mz_uint s_tdefl_num_probes[11] = { 0, 1, 6, 32, 16, 32, 128, 256, 512, 768, 1500 }; // level may actually range from [0,10] (10 is a "hidden" max level, where we want a bit more compression and it's fine if throughput to fall off a cliff on some files). mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy) { mz_uint comp_flags = s_tdefl_num_probes[(level >= 0) ? MZ_MIN(10, level) : MZ_DEFAULT_LEVEL] | ((level <= 3) ? TDEFL_GREEDY_PARSING_FLAG : 0); if (window_bits > 0) comp_flags |= TDEFL_WRITE_ZLIB_HEADER; if (!level) comp_flags |= TDEFL_FORCE_ALL_RAW_BLOCKS; else if (strategy == MZ_FILTERED) comp_flags |= TDEFL_FILTER_MATCHES; else if (strategy == MZ_HUFFMAN_ONLY) comp_flags &= ~TDEFL_MAX_PROBES_MASK; else if (strategy == MZ_FIXED) comp_flags |= TDEFL_FORCE_ALL_STATIC_BLOCKS; else if (strategy == MZ_RLE) comp_flags |= TDEFL_RLE_MATCHES; return comp_flags; } #endif //MINIZ_NO_ZLIB_APIS #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable:4204) // nonstandard extension used : non-constant aggregate initializer (also supported by GNU C and C99, so no big deal) #endif // Simple PNG writer function by Alex Evans, 2011. Released into the public domain: https://gist.github.com/908299, more context at // http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/. // This is actually a modification of Alex's original code so PNG files generated by this function pass pngcheck. void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int h, int num_chans, size_t *pLen_out, mz_uint level, mz_bool flip) { // Using a local copy of this array here in case MINIZ_NO_ZLIB_APIS was defined. static const mz_uint s_tdefl_png_num_probes[11] = { 0, 1, 6, 32, 16, 32, 128, 256, 512, 768, 1500 }; tdefl_compressor *pComp = (tdefl_compressor *)MZ_MALLOC(sizeof(tdefl_compressor)); tdefl_output_buffer out_buf; int i, bpl = w * num_chans, y, z; mz_uint32 c; *pLen_out = 0; if (!pComp) return NULL; MZ_CLEAR_OBJ(out_buf); out_buf.m_expandable = MZ_TRUE; out_buf.m_capacity = 57+MZ_MAX(64, (1+bpl)*h); if (NULL == (out_buf.m_pBuf = (mz_uint8*)MZ_MALLOC(out_buf.m_capacity))) { MZ_FREE(pComp); return NULL; } // write dummy header for (z = 41; z; --z) tdefl_output_buffer_putter(&z, 1, &out_buf); // compress image data tdefl_init(pComp, tdefl_output_buffer_putter, &out_buf, s_tdefl_png_num_probes[MZ_MIN(10, level)] | TDEFL_WRITE_ZLIB_HEADER); for (y = 0; y < h; ++y) { tdefl_compress_buffer(pComp, &z, 1, TDEFL_NO_FLUSH); tdefl_compress_buffer(pComp, (mz_uint8*)pImage + (flip ? (h - 1 - y) : y) * bpl, bpl, TDEFL_NO_FLUSH); } if (tdefl_compress_buffer(pComp, NULL, 0, TDEFL_FINISH) != TDEFL_STATUS_DONE) { MZ_FREE(pComp); MZ_FREE(out_buf.m_pBuf); return NULL; } // write real header *pLen_out = out_buf.m_size-41; { static const mz_uint8 chans[] = {0x00, 0x00, 0x04, 0x02, 0x06}; mz_uint8 pnghdr[41]={0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52, 0,0,(mz_uint8)(w>>8),(mz_uint8)w,0,0,(mz_uint8)(h>>8),(mz_uint8)h,8,chans[num_chans],0,0,0,0,0,0,0, (mz_uint8)(*pLen_out>>24),(mz_uint8)(*pLen_out>>16),(mz_uint8)(*pLen_out>>8),(mz_uint8)*pLen_out,0x49,0x44,0x41,0x54}; c=(mz_uint32)mz_crc32(MZ_CRC32_INIT,pnghdr+12,17); for (i=0; i<4; ++i, c<<=8) ((mz_uint8*)(pnghdr+29))[i]=(mz_uint8)(c>>24); memcpy(out_buf.m_pBuf, pnghdr, 41); } // write footer (IDAT CRC-32, followed by IEND chunk) if (!tdefl_output_buffer_putter("\0\0\0\0\0\0\0\0\x49\x45\x4e\x44\xae\x42\x60\x82", 16, &out_buf)) { *pLen_out = 0; MZ_FREE(pComp); MZ_FREE(out_buf.m_pBuf); return NULL; } c = (mz_uint32)mz_crc32(MZ_CRC32_INIT,out_buf.m_pBuf+41-4, *pLen_out+4); for (i=0; i<4; ++i, c<<=8) (out_buf.m_pBuf+out_buf.m_size-16)[i] = (mz_uint8)(c >> 24); // compute final size of file, grab compressed data buffer and return *pLen_out += 57; MZ_FREE(pComp); return out_buf.m_pBuf; } void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out) { // Level 6 corresponds to TDEFL_DEFAULT_MAX_PROBES or MZ_DEFAULT_LEVEL (but we can't depend on MZ_DEFAULT_LEVEL being available in case the zlib API's where #defined out) return tdefl_write_image_to_png_file_in_memory_ex(pImage, w, h, num_chans, pLen_out, 6, MZ_FALSE); } #ifdef _MSC_VER #pragma warning (pop) #endif // ------------------- .ZIP archive reading #ifndef MINIZ_NO_ARCHIVE_APIS #ifdef MINIZ_NO_STDIO #define MZ_FILE void * #else #include <stdio.h> #include <sys/stat.h> #if defined(_MSC_VER) || defined(__MINGW64__) static FILE *mz_fopen(const char *pFilename, const char *pMode) { FILE* pFile = NULL; fopen_s(&pFile, pFilename, pMode); return pFile; } static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream) { FILE* pFile = NULL; if (freopen_s(&pFile, pPath, pMode, pStream)) return NULL; return pFile; } #ifndef MINIZ_NO_TIME #include <sys/utime.h> #endif #define MZ_FILE FILE #define MZ_FOPEN mz_fopen #define MZ_FCLOSE fclose #define MZ_FREAD fread #define MZ_FWRITE fwrite #define MZ_FTELL64 _ftelli64 #define MZ_FSEEK64 _fseeki64 #define MZ_FILE_STAT_STRUCT _stat #define MZ_FILE_STAT _stat #define MZ_FFLUSH fflush #define MZ_FREOPEN mz_freopen #define MZ_DELETE_FILE remove #elif defined(__MINGW32__) #ifndef MINIZ_NO_TIME #include <sys/utime.h> #endif #define MZ_FILE FILE #define MZ_FOPEN(f, m) fopen(f, m) #define MZ_FCLOSE fclose #define MZ_FREAD fread #define MZ_FWRITE fwrite #define MZ_FTELL64 ftello64 #define MZ_FSEEK64 fseeko64 #define MZ_FILE_STAT_STRUCT _stat #define MZ_FILE_STAT _stat #define MZ_FFLUSH fflush #define MZ_FREOPEN(f, m, s) freopen(f, m, s) #define MZ_DELETE_FILE remove #elif defined(__TINYC__) #ifndef MINIZ_NO_TIME #include <sys/utime.h> #endif #define MZ_FILE FILE #define MZ_FOPEN(f, m) fopen(f, m) #define MZ_FCLOSE fclose #define MZ_FREAD fread #define MZ_FWRITE fwrite #define MZ_FTELL64 ftell #define MZ_FSEEK64 fseek #define MZ_FILE_STAT_STRUCT stat #define MZ_FILE_STAT stat #define MZ_FFLUSH fflush #define MZ_FREOPEN(f, m, s) freopen(f, m, s) #define MZ_DELETE_FILE remove #elif defined(__GNUC__) && _LARGEFILE64_SOURCE #ifndef MINIZ_NO_TIME #include <utime.h> #endif #define MZ_FILE FILE #define MZ_FOPEN(f, m) fopen64(f, m) #define MZ_FCLOSE fclose #define MZ_FREAD fread #define MZ_FWRITE fwrite #define MZ_FTELL64 ftello64 #define MZ_FSEEK64 fseeko64 #define MZ_FILE_STAT_STRUCT stat64 #define MZ_FILE_STAT stat64 #define MZ_FFLUSH fflush #define MZ_FREOPEN(p, m, s) freopen64(p, m, s) #define MZ_DELETE_FILE remove #else #ifndef MINIZ_NO_TIME #include <utime.h> #endif #define MZ_FILE FILE #define MZ_FOPEN(f, m) fopen(f, m) #define MZ_FCLOSE fclose #define MZ_FREAD fread #define MZ_FWRITE fwrite #define MZ_FTELL64 ftello #define MZ_FSEEK64 fseeko #define MZ_FILE_STAT_STRUCT stat #define MZ_FILE_STAT stat #define MZ_FFLUSH fflush #define MZ_FREOPEN(f, m, s) freopen(f, m, s) #define MZ_DELETE_FILE remove #endif // #ifdef _MSC_VER #endif // #ifdef MINIZ_NO_STDIO #define MZ_TOLOWER(c) ((((c) >= 'A') && ((c) <= 'Z')) ? ((c) - 'A' + 'a') : (c)) // Various ZIP archive enums. To completely avoid cross platform compiler alignment and platform endian issues, miniz.c doesn't use structs for any of this stuff. enum { // ZIP archive identifiers and record sizes MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG = 0x06054b50, MZ_ZIP_CENTRAL_DIR_HEADER_SIG = 0x02014b50, MZ_ZIP_LOCAL_DIR_HEADER_SIG = 0x04034b50, MZ_ZIP_LOCAL_DIR_HEADER_SIZE = 30, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE = 46, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE = 22, // Central directory header record offsets MZ_ZIP_CDH_SIG_OFS = 0, MZ_ZIP_CDH_VERSION_MADE_BY_OFS = 4, MZ_ZIP_CDH_VERSION_NEEDED_OFS = 6, MZ_ZIP_CDH_BIT_FLAG_OFS = 8, MZ_ZIP_CDH_METHOD_OFS = 10, MZ_ZIP_CDH_FILE_TIME_OFS = 12, MZ_ZIP_CDH_FILE_DATE_OFS = 14, MZ_ZIP_CDH_CRC32_OFS = 16, MZ_ZIP_CDH_COMPRESSED_SIZE_OFS = 20, MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS = 24, MZ_ZIP_CDH_FILENAME_LEN_OFS = 28, MZ_ZIP_CDH_EXTRA_LEN_OFS = 30, MZ_ZIP_CDH_COMMENT_LEN_OFS = 32, MZ_ZIP_CDH_DISK_START_OFS = 34, MZ_ZIP_CDH_INTERNAL_ATTR_OFS = 36, MZ_ZIP_CDH_EXTERNAL_ATTR_OFS = 38, MZ_ZIP_CDH_LOCAL_HEADER_OFS = 42, // Local directory header offsets MZ_ZIP_LDH_SIG_OFS = 0, MZ_ZIP_LDH_VERSION_NEEDED_OFS = 4, MZ_ZIP_LDH_BIT_FLAG_OFS = 6, MZ_ZIP_LDH_METHOD_OFS = 8, MZ_ZIP_LDH_FILE_TIME_OFS = 10, MZ_ZIP_LDH_FILE_DATE_OFS = 12, MZ_ZIP_LDH_CRC32_OFS = 14, MZ_ZIP_LDH_COMPRESSED_SIZE_OFS = 18, MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS = 22, MZ_ZIP_LDH_FILENAME_LEN_OFS = 26, MZ_ZIP_LDH_EXTRA_LEN_OFS = 28, // End of central directory offsets MZ_ZIP_ECDH_SIG_OFS = 0, MZ_ZIP_ECDH_NUM_THIS_DISK_OFS = 4, MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS = 6, MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS = 8, MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS = 10, MZ_ZIP_ECDH_CDIR_SIZE_OFS = 12, MZ_ZIP_ECDH_CDIR_OFS_OFS = 16, MZ_ZIP_ECDH_COMMENT_SIZE_OFS = 20, }; typedef struct { void *m_p; size_t m_size, m_capacity; mz_uint m_element_size; } mz_zip_array; struct mz_zip_internal_state_tag { mz_zip_array m_central_dir; mz_zip_array m_central_dir_offsets; mz_zip_array m_sorted_central_dir_offsets; MZ_FILE *m_pFile; void *m_pMem; size_t m_mem_size; size_t m_mem_capacity; }; #define MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(array_ptr, element_size) (array_ptr)->m_element_size = element_size #define MZ_ZIP_ARRAY_ELEMENT(array_ptr, element_type, index) ((element_type *)((array_ptr)->m_p))[index] static MZ_FORCEINLINE void mz_zip_array_clear(mz_zip_archive *pZip, mz_zip_array *pArray) { pZip->m_pFree(pZip->m_pAlloc_opaque, pArray->m_p); memset(pArray, 0, sizeof(mz_zip_array)); } static mz_bool mz_zip_array_ensure_capacity(mz_zip_archive *pZip, mz_zip_array *pArray, size_t min_new_capacity, mz_uint growing) { void *pNew_p; size_t new_capacity = min_new_capacity; MZ_ASSERT(pArray->m_element_size); if (pArray->m_capacity >= min_new_capacity) return MZ_TRUE; if (growing) { new_capacity = MZ_MAX(1, pArray->m_capacity); while (new_capacity < min_new_capacity) new_capacity *= 2; } if (NULL == (pNew_p = pZip->m_pRealloc(pZip->m_pAlloc_opaque, pArray->m_p, pArray->m_element_size, new_capacity))) return MZ_FALSE; pArray->m_p = pNew_p; pArray->m_capacity = new_capacity; return MZ_TRUE; } static MZ_FORCEINLINE mz_bool mz_zip_array_reserve(mz_zip_archive *pZip, mz_zip_array *pArray, size_t new_capacity, mz_uint growing) { if (new_capacity > pArray->m_capacity) { if (!mz_zip_array_ensure_capacity(pZip, pArray, new_capacity, growing)) return MZ_FALSE; } return MZ_TRUE; } static MZ_FORCEINLINE mz_bool mz_zip_array_resize(mz_zip_archive *pZip, mz_zip_array *pArray, size_t new_size, mz_uint growing) { if (new_size > pArray->m_capacity) { if (!mz_zip_array_ensure_capacity(pZip, pArray, new_size, growing)) return MZ_FALSE; } pArray->m_size = new_size; return MZ_TRUE; } static MZ_FORCEINLINE mz_bool mz_zip_array_ensure_room(mz_zip_archive *pZip, mz_zip_array *pArray, size_t n) { return mz_zip_array_reserve(pZip, pArray, pArray->m_size + n, MZ_TRUE); } static MZ_FORCEINLINE mz_bool mz_zip_array_push_back(mz_zip_archive *pZip, mz_zip_array *pArray, const void *pElements, size_t n) { size_t orig_size = pArray->m_size; if (!mz_zip_array_resize(pZip, pArray, orig_size + n, MZ_TRUE)) return MZ_FALSE; memcpy((mz_uint8*)pArray->m_p + orig_size * pArray->m_element_size, pElements, n * pArray->m_element_size); return MZ_TRUE; } #ifndef MINIZ_NO_TIME static time_t mz_zip_dos_to_time_t(int dos_time, int dos_date) { struct tm tm; memset(&tm, 0, sizeof(tm)); tm.tm_isdst = -1; tm.tm_year = ((dos_date >> 9) & 127) + 1980 - 1900; tm.tm_mon = ((dos_date >> 5) & 15) - 1; tm.tm_mday = dos_date & 31; tm.tm_hour = (dos_time >> 11) & 31; tm.tm_min = (dos_time >> 5) & 63; tm.tm_sec = (dos_time << 1) & 62; return mktime(&tm); } static void mz_zip_time_to_dos_time(time_t time, mz_uint16 *pDOS_time, mz_uint16 *pDOS_date) { #ifdef _MSC_VER struct tm tm_struct; struct tm *tm = &tm_struct; errno_t err = localtime_s(tm, &time); if (err) { *pDOS_date = 0; *pDOS_time = 0; return; } #else struct tm *tm = localtime(&time); #endif *pDOS_time = (mz_uint16)(((tm->tm_hour) << 11) + ((tm->tm_min) << 5) + ((tm->tm_sec) >> 1)); *pDOS_date = (mz_uint16)(((tm->tm_year + 1900 - 1980) << 9) + ((tm->tm_mon + 1) << 5) + tm->tm_mday); } #endif #ifndef MINIZ_NO_STDIO static mz_bool mz_zip_get_file_modified_time(const char *pFilename, mz_uint16 *pDOS_time, mz_uint16 *pDOS_date) { #ifdef MINIZ_NO_TIME (void)pFilename; *pDOS_date = *pDOS_time = 0; #else struct MZ_FILE_STAT_STRUCT file_stat; // On Linux with x86 glibc, this call will fail on large files (>= 0x80000000 bytes) unless you compiled with _LARGEFILE64_SOURCE. Argh. if (MZ_FILE_STAT(pFilename, &file_stat) != 0) return MZ_FALSE; mz_zip_time_to_dos_time(file_stat.st_mtime, pDOS_time, pDOS_date); #endif // #ifdef MINIZ_NO_TIME return MZ_TRUE; } #ifndef MINIZ_NO_TIME static mz_bool mz_zip_set_file_times(const char *pFilename, time_t access_time, time_t modified_time) { struct utimbuf t; t.actime = access_time; t.modtime = modified_time; return !utime(pFilename, &t); } #endif // #ifndef MINIZ_NO_TIME #endif // #ifndef MINIZ_NO_STDIO static mz_bool mz_zip_reader_init_internal(mz_zip_archive *pZip, mz_uint32 flags) { (void)flags; if ((!pZip) || (pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID)) return MZ_FALSE; if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func; if (!pZip->m_pFree) pZip->m_pFree = def_free_func; if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func; pZip->m_zip_mode = MZ_ZIP_MODE_READING; pZip->m_archive_size = 0; pZip->m_central_directory_file_ofs = 0; pZip->m_total_files = 0; if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(mz_zip_internal_state)))) return MZ_FALSE; memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state)); MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, sizeof(mz_uint8)); MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, sizeof(mz_uint32)); MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, sizeof(mz_uint32)); return MZ_TRUE; } static MZ_FORCEINLINE mz_bool mz_zip_reader_filename_less(const mz_zip_array *pCentral_dir_array, const mz_zip_array *pCentral_dir_offsets, mz_uint l_index, mz_uint r_index) { const mz_uint8 *pL = &MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_array, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, l_index)), *pE; const mz_uint8 *pR = &MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_array, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, r_index)); mz_uint l_len = MZ_READ_LE16(pL + MZ_ZIP_CDH_FILENAME_LEN_OFS), r_len = MZ_READ_LE16(pR + MZ_ZIP_CDH_FILENAME_LEN_OFS); mz_uint8 l = 0, r = 0; pL += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; pR += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; pE = pL + MZ_MIN(l_len, r_len); while (pL < pE) { if ((l = MZ_TOLOWER(*pL)) != (r = MZ_TOLOWER(*pR))) break; pL++; pR++; } return (pL == pE) ? (l_len < r_len) : (l < r); } #define MZ_SWAP_UINT32(a, b) do { mz_uint32 t = a; a = b; b = t; } MZ_MACRO_END // Heap sort of lowercased filenames, used to help accelerate plain central directory searches by mz_zip_reader_locate_file(). (Could also use qsort(), but it could allocate memory.) static void mz_zip_reader_sort_central_dir_offsets_by_filename(mz_zip_archive *pZip) { mz_zip_internal_state *pState = pZip->m_pState; const mz_zip_array *pCentral_dir_offsets = &pState->m_central_dir_offsets; const mz_zip_array *pCentral_dir = &pState->m_central_dir; mz_uint32 *pIndices = &MZ_ZIP_ARRAY_ELEMENT(&pState->m_sorted_central_dir_offsets, mz_uint32, 0); const int size = pZip->m_total_files; int start = (size - 2) >> 1, end; while (start >= 0) { int child, root = start; for ( ; ; ) { if ((child = (root << 1) + 1) >= size) break; child += (((child + 1) < size) && (mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[child], pIndices[child + 1]))); if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[root], pIndices[child])) break; MZ_SWAP_UINT32(pIndices[root], pIndices[child]); root = child; } start--; } end = size - 1; while (end > 0) { int child, root = 0; MZ_SWAP_UINT32(pIndices[end], pIndices[0]); for ( ; ; ) { if ((child = (root << 1) + 1) >= end) break; child += (((child + 1) < end) && mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[child], pIndices[child + 1])); if (!mz_zip_reader_filename_less(pCentral_dir, pCentral_dir_offsets, pIndices[root], pIndices[child])) break; MZ_SWAP_UINT32(pIndices[root], pIndices[child]); root = child; } end--; } } static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint32 flags) { mz_uint cdir_size, num_this_disk, cdir_disk_index; mz_uint64 cdir_ofs; mz_int64 cur_file_ofs; const mz_uint8 *p; mz_uint32 buf_u32[4096 / sizeof(mz_uint32)]; mz_uint8 *pBuf = (mz_uint8 *)buf_u32; mz_bool sort_central_dir = ((flags & MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY) == 0); // Basic sanity checks - reject files which are too small, and check the first 4 bytes of the file to make sure a local header is there. if (pZip->m_archive_size < MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) return MZ_FALSE; // Find the end of central directory record by scanning the file from the end towards the beginning. cur_file_ofs = MZ_MAX((mz_int64)pZip->m_archive_size - (mz_int64)sizeof(buf_u32), 0); for ( ; ; ) { int i, n = (int)MZ_MIN(sizeof(buf_u32), pZip->m_archive_size - cur_file_ofs); if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, n) != (mz_uint)n) return MZ_FALSE; for (i = n - 4; i >= 0; --i) if (MZ_READ_LE32(pBuf + i) == MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG) break; if (i >= 0) { cur_file_ofs += i; break; } if ((!cur_file_ofs) || ((pZip->m_archive_size - cur_file_ofs) >= (0xFFFF + MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE))) return MZ_FALSE; cur_file_ofs = MZ_MAX(cur_file_ofs - (sizeof(buf_u32) - 3), 0); } // Read and verify the end of central directory record. if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) != MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) return MZ_FALSE; if ((MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_SIG_OFS) != MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG) || ((pZip->m_total_files = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS)) != MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS))) return MZ_FALSE; num_this_disk = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_THIS_DISK_OFS); cdir_disk_index = MZ_READ_LE16(pBuf + MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS); if (((num_this_disk | cdir_disk_index) != 0) && ((num_this_disk != 1) || (cdir_disk_index != 1))) return MZ_FALSE; if ((cdir_size = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_SIZE_OFS)) < pZip->m_total_files * MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) return MZ_FALSE; cdir_ofs = MZ_READ_LE32(pBuf + MZ_ZIP_ECDH_CDIR_OFS_OFS); if ((cdir_ofs + (mz_uint64)cdir_size) > pZip->m_archive_size) return MZ_FALSE; pZip->m_central_directory_file_ofs = cdir_ofs; if (pZip->m_total_files) { mz_uint i, n; // Read the entire central directory into a heap block, and allocate another heap block to hold the unsorted central dir file record offsets, and another to hold the sorted indices. if ((!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir, cdir_size, MZ_FALSE)) || (!mz_zip_array_resize(pZip, &pZip->m_pState->m_central_dir_offsets, pZip->m_total_files, MZ_FALSE))) return MZ_FALSE; if (sort_central_dir) { if (!mz_zip_array_resize(pZip, &pZip->m_pState->m_sorted_central_dir_offsets, pZip->m_total_files, MZ_FALSE)) return MZ_FALSE; } if (pZip->m_pRead(pZip->m_pIO_opaque, cdir_ofs, pZip->m_pState->m_central_dir.m_p, cdir_size) != cdir_size) return MZ_FALSE; // Now create an index into the central directory file records, do some basic sanity checking on each record, and check for zip64 entries (which are not yet supported). p = (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p; for (n = cdir_size, i = 0; i < pZip->m_total_files; ++i) { mz_uint total_header_size, comp_size, decomp_size, disk_index; if ((n < MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) || (MZ_READ_LE32(p) != MZ_ZIP_CENTRAL_DIR_HEADER_SIG)) return MZ_FALSE; MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, i) = (mz_uint32)(p - (const mz_uint8 *)pZip->m_pState->m_central_dir.m_p); if (sort_central_dir) MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_sorted_central_dir_offsets, mz_uint32, i) = i; comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); decomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS); if (((!MZ_READ_LE32(p + MZ_ZIP_CDH_METHOD_OFS)) && (decomp_size != comp_size)) || (decomp_size && !comp_size) || (decomp_size == 0xFFFFFFFF) || (comp_size == 0xFFFFFFFF)) return MZ_FALSE; disk_index = MZ_READ_LE16(p + MZ_ZIP_CDH_DISK_START_OFS); if ((disk_index != num_this_disk) && (disk_index != 1)) return MZ_FALSE; if (((mz_uint64)MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS) + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + comp_size) > pZip->m_archive_size) return MZ_FALSE; if ((total_header_size = MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS)) > n) return MZ_FALSE; n -= total_header_size; p += total_header_size; } } if (sort_central_dir) mz_zip_reader_sort_central_dir_offsets_by_filename(pZip); return MZ_TRUE; } mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags) { if ((!pZip) || (!pZip->m_pRead)) return MZ_FALSE; if (!mz_zip_reader_init_internal(pZip, flags)) return MZ_FALSE; pZip->m_archive_size = size; if (!mz_zip_reader_read_central_dir(pZip, flags)) { mz_zip_reader_end(pZip); return MZ_FALSE; } return MZ_TRUE; } static size_t mz_zip_mem_read_func(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n) { mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; size_t s = (file_ofs >= pZip->m_archive_size) ? 0 : (size_t)MZ_MIN(pZip->m_archive_size - file_ofs, n); memcpy(pBuf, (const mz_uint8 *)pZip->m_pState->m_pMem + file_ofs, s); return s; } mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags) { if (!mz_zip_reader_init_internal(pZip, flags)) return MZ_FALSE; pZip->m_archive_size = size; pZip->m_pRead = mz_zip_mem_read_func; pZip->m_pIO_opaque = pZip; #ifdef __cplusplus pZip->m_pState->m_pMem = const_cast<void *>(pMem); #else pZip->m_pState->m_pMem = (void *)pMem; #endif pZip->m_pState->m_mem_size = size; if (!mz_zip_reader_read_central_dir(pZip, flags)) { mz_zip_reader_end(pZip); return MZ_FALSE; } return MZ_TRUE; } #ifndef MINIZ_NO_STDIO static size_t mz_zip_file_read_func(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n) { mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile); if (((mz_int64)file_ofs < 0) || (((cur_ofs != (mz_int64)file_ofs)) && (MZ_FSEEK64(pZip->m_pState->m_pFile, (mz_int64)file_ofs, SEEK_SET)))) return 0; return MZ_FREAD(pBuf, 1, n, pZip->m_pState->m_pFile); } mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags) { mz_uint64 file_size; MZ_FILE *pFile = MZ_FOPEN(pFilename, "rb"); if (!pFile) return MZ_FALSE; if (MZ_FSEEK64(pFile, 0, SEEK_END)) { MZ_FCLOSE(pFile); return MZ_FALSE; } file_size = MZ_FTELL64(pFile); if (!mz_zip_reader_init_internal(pZip, flags)) { MZ_FCLOSE(pFile); return MZ_FALSE; } pZip->m_pRead = mz_zip_file_read_func; pZip->m_pIO_opaque = pZip; pZip->m_pState->m_pFile = pFile; pZip->m_archive_size = file_size; if (!mz_zip_reader_read_central_dir(pZip, flags)) { mz_zip_reader_end(pZip); return MZ_FALSE; } return MZ_TRUE; } #endif // #ifndef MINIZ_NO_STDIO mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip) { return pZip ? pZip->m_total_files : 0; } static MZ_FORCEINLINE const mz_uint8 *mz_zip_reader_get_cdh(mz_zip_archive *pZip, mz_uint file_index) { if ((!pZip) || (!pZip->m_pState) || (file_index >= pZip->m_total_files) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) return NULL; return &MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index)); } mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index) { mz_uint m_bit_flag; const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); if (!p) return MZ_FALSE; m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS); return (m_bit_flag & 1); } mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index) { mz_uint filename_len, external_attr; const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); if (!p) return MZ_FALSE; // First see if the filename ends with a '/' character. filename_len = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); if (filename_len) { if (*(p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_len - 1) == '/') return MZ_TRUE; } // Bugfix: This code was also checking if the internal attribute was non-zero, which wasn't correct. // Most/all zip writers (hopefully) set DOS file/directory attributes in the low 16-bits, so check for the DOS directory flag and ignore the source OS ID in the created by field. // FIXME: Remove this check? Is it necessary - we already check the filename. external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS); if ((external_attr & 0x10) != 0) return MZ_TRUE; return MZ_FALSE; } mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat) { mz_uint n; const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); if ((!p) || (!pStat)) return MZ_FALSE; // Unpack the central directory record. pStat->m_file_index = file_index; pStat->m_central_dir_ofs = MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index); pStat->m_version_made_by = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_MADE_BY_OFS); pStat->m_version_needed = MZ_READ_LE16(p + MZ_ZIP_CDH_VERSION_NEEDED_OFS); pStat->m_bit_flag = MZ_READ_LE16(p + MZ_ZIP_CDH_BIT_FLAG_OFS); pStat->m_method = MZ_READ_LE16(p + MZ_ZIP_CDH_METHOD_OFS); #ifndef MINIZ_NO_TIME pStat->m_time = mz_zip_dos_to_time_t(MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_TIME_OFS), MZ_READ_LE16(p + MZ_ZIP_CDH_FILE_DATE_OFS)); #endif pStat->m_crc32 = MZ_READ_LE32(p + MZ_ZIP_CDH_CRC32_OFS); pStat->m_comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); pStat->m_uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS); pStat->m_internal_attr = MZ_READ_LE16(p + MZ_ZIP_CDH_INTERNAL_ATTR_OFS); pStat->m_external_attr = MZ_READ_LE32(p + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS); pStat->m_local_header_ofs = MZ_READ_LE32(p + MZ_ZIP_CDH_LOCAL_HEADER_OFS); // Copy as much of the filename and comment as possible. n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE - 1); memcpy(pStat->m_filename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n); pStat->m_filename[n] = '\0'; n = MZ_READ_LE16(p + MZ_ZIP_CDH_COMMENT_LEN_OFS); n = MZ_MIN(n, MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE - 1); pStat->m_comment_size = n; memcpy(pStat->m_comment, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(p + MZ_ZIP_CDH_EXTRA_LEN_OFS), n); pStat->m_comment[n] = '\0'; return MZ_TRUE; } mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size) { mz_uint n; const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); if (!p) { if (filename_buf_size) pFilename[0] = '\0'; return 0; } n = MZ_READ_LE16(p + MZ_ZIP_CDH_FILENAME_LEN_OFS); if (filename_buf_size) { n = MZ_MIN(n, filename_buf_size - 1); memcpy(pFilename, p + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n); pFilename[n] = '\0'; } return n + 1; } static MZ_FORCEINLINE mz_bool mz_zip_reader_string_equal(const char *pA, const char *pB, mz_uint len, mz_uint flags) { mz_uint i; if (flags & MZ_ZIP_FLAG_CASE_SENSITIVE) return 0 == memcmp(pA, pB, len); for (i = 0; i < len; ++i) if (MZ_TOLOWER(pA[i]) != MZ_TOLOWER(pB[i])) return MZ_FALSE; return MZ_TRUE; } static MZ_FORCEINLINE int mz_zip_reader_filename_compare(const mz_zip_array *pCentral_dir_array, const mz_zip_array *pCentral_dir_offsets, mz_uint l_index, const char *pR, mz_uint r_len) { const mz_uint8 *pL = &MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_array, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(pCentral_dir_offsets, mz_uint32, l_index)), *pE; mz_uint l_len = MZ_READ_LE16(pL + MZ_ZIP_CDH_FILENAME_LEN_OFS); mz_uint8 l = 0, r = 0; pL += MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; pE = pL + MZ_MIN(l_len, r_len); while (pL < pE) { if ((l = MZ_TOLOWER(*pL)) != (r = MZ_TOLOWER(*pR))) break; pL++; pR++; } return (pL == pE) ? (int)(l_len - r_len) : (l - r); } static int mz_zip_reader_locate_file_binary_search(mz_zip_archive *pZip, const char *pFilename) { mz_zip_internal_state *pState = pZip->m_pState; const mz_zip_array *pCentral_dir_offsets = &pState->m_central_dir_offsets; const mz_zip_array *pCentral_dir = &pState->m_central_dir; mz_uint32 *pIndices = &MZ_ZIP_ARRAY_ELEMENT(&pState->m_sorted_central_dir_offsets, mz_uint32, 0); const int size = pZip->m_total_files; const mz_uint filename_len = (mz_uint)strlen(pFilename); int l = 0, h = size - 1; while (l <= h) { int m = (l + h) >> 1, file_index = pIndices[m], comp = mz_zip_reader_filename_compare(pCentral_dir, pCentral_dir_offsets, file_index, pFilename, filename_len); if (!comp) return file_index; else if (comp < 0) l = m + 1; else h = m - 1; } return -1; } int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags) { mz_uint file_index; size_t name_len, comment_len; if ((!pZip) || (!pZip->m_pState) || (!pName) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) return -1; if (((flags & (MZ_ZIP_FLAG_IGNORE_PATH | MZ_ZIP_FLAG_CASE_SENSITIVE)) == 0) && (!pComment) && (pZip->m_pState->m_sorted_central_dir_offsets.m_size)) return mz_zip_reader_locate_file_binary_search(pZip, pName); name_len = strlen(pName); if (name_len > 0xFFFF) return -1; comment_len = pComment ? strlen(pComment) : 0; if (comment_len > 0xFFFF) return -1; for (file_index = 0; file_index < pZip->m_total_files; file_index++) { const mz_uint8 *pHeader = &MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir, mz_uint8, MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32, file_index)); mz_uint filename_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_FILENAME_LEN_OFS); const char *pFilename = (const char *)pHeader + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE; if (filename_len < name_len) continue; if (comment_len) { mz_uint file_extra_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_EXTRA_LEN_OFS), file_comment_len = MZ_READ_LE16(pHeader + MZ_ZIP_CDH_COMMENT_LEN_OFS); const char *pFile_comment = pFilename + filename_len + file_extra_len; if ((file_comment_len != comment_len) || (!mz_zip_reader_string_equal(pComment, pFile_comment, file_comment_len, flags))) continue; } if ((flags & MZ_ZIP_FLAG_IGNORE_PATH) && (filename_len)) { int ofs = filename_len - 1; do { if ((pFilename[ofs] == '/') || (pFilename[ofs] == '\\') || (pFilename[ofs] == ':')) break; } while (--ofs >= 0); ofs++; pFilename += ofs; filename_len -= ofs; } if ((filename_len == name_len) && (mz_zip_reader_string_equal(pName, pFilename, filename_len, flags))) return file_index; } return -1; } mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size) { int status = TINFL_STATUS_DONE; mz_uint64 needed_size, cur_file_ofs, comp_remaining, out_buf_ofs = 0, read_buf_size, read_buf_ofs = 0, read_buf_avail; mz_zip_archive_file_stat file_stat; void *pRead_buf; mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32; tinfl_decompressor inflator; if ((buf_size) && (!pBuf)) return MZ_FALSE; if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) return MZ_FALSE; // Empty file, or a directory (but not always a directory - I've seen odd zips with directories that have compressed data which inflates to 0 bytes) if (!file_stat.m_comp_size) return MZ_TRUE; // Entry is a subdirectory (I've seen old zips with dir entries which have compressed deflate data which inflates to 0 bytes, but these entries claim to uncompress to 512 bytes in the headers). // I'm torn how to handle this case - should it fail instead? if (mz_zip_reader_is_file_a_directory(pZip, file_index)) return MZ_TRUE; // Encryption and patch files are not supported. if (file_stat.m_bit_flag & (1 | 32)) return MZ_FALSE; // This function only supports stored and deflate. if ((!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (file_stat.m_method != 0) && (file_stat.m_method != MZ_DEFLATED)) return MZ_FALSE; // Ensure supplied output buffer is large enough. needed_size = (flags & MZ_ZIP_FLAG_COMPRESSED_DATA) ? file_stat.m_comp_size : file_stat.m_uncomp_size; if (buf_size < needed_size) return MZ_FALSE; // Read and parse the local directory entry. cur_file_ofs = file_stat.m_local_header_ofs; if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE) return MZ_FALSE; if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG) return MZ_FALSE; cur_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS); if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size) return MZ_FALSE; if ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!file_stat.m_method)) { // The file is stored or the caller has requested the compressed data. if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pBuf, (size_t)needed_size) != needed_size) return MZ_FALSE; return ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) != 0) || (mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, (size_t)file_stat.m_uncomp_size) == file_stat.m_crc32); } // Decompress the file either directly from memory or from a file input buffer. tinfl_init(&inflator); if (pZip->m_pState->m_pMem) { // Read directly from the archive in memory. pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs; read_buf_size = read_buf_avail = file_stat.m_comp_size; comp_remaining = 0; } else if (pUser_read_buf) { // Use a user provided read buffer. if (!user_read_buf_size) return MZ_FALSE; pRead_buf = (mz_uint8 *)pUser_read_buf; read_buf_size = user_read_buf_size; read_buf_avail = 0; comp_remaining = file_stat.m_comp_size; } else { // Temporarily allocate a read buffer. read_buf_size = MZ_MIN(file_stat.m_comp_size, MZ_ZIP_MAX_IO_BUF_SIZE); #ifdef _MSC_VER if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (read_buf_size > 0x7FFFFFFF)) #else if (((sizeof(size_t) == sizeof(mz_uint32))) && (read_buf_size > 0x7FFFFFFF)) #endif return MZ_FALSE; if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)read_buf_size))) return MZ_FALSE; read_buf_avail = 0; comp_remaining = file_stat.m_comp_size; } do { size_t in_buf_size, out_buf_size = (size_t)(file_stat.m_uncomp_size - out_buf_ofs); if ((!read_buf_avail) && (!pZip->m_pState->m_pMem)) { read_buf_avail = MZ_MIN(read_buf_size, comp_remaining); if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail) { status = TINFL_STATUS_FAILED; break; } cur_file_ofs += read_buf_avail; comp_remaining -= read_buf_avail; read_buf_ofs = 0; } in_buf_size = (size_t)read_buf_avail; status = tinfl_decompress(&inflator, (mz_uint8 *)pRead_buf + read_buf_ofs, &in_buf_size, (mz_uint8 *)pBuf, (mz_uint8 *)pBuf + out_buf_ofs, &out_buf_size, TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF | (comp_remaining ? TINFL_FLAG_HAS_MORE_INPUT : 0)); read_buf_avail -= in_buf_size; read_buf_ofs += in_buf_size; out_buf_ofs += out_buf_size; } while (status == TINFL_STATUS_NEEDS_MORE_INPUT); if (status == TINFL_STATUS_DONE) { // Make sure the entire file was decompressed, and check its CRC. if ((out_buf_ofs != file_stat.m_uncomp_size) || (mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, (size_t)file_stat.m_uncomp_size) != file_stat.m_crc32)) status = TINFL_STATUS_FAILED; } if ((!pZip->m_pState->m_pMem) && (!pUser_read_buf)) pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); return status == TINFL_STATUS_DONE; } mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size) { int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); if (file_index < 0) return MZ_FALSE; return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, flags, pUser_read_buf, user_read_buf_size); } mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags) { return mz_zip_reader_extract_to_mem_no_alloc(pZip, file_index, pBuf, buf_size, flags, NULL, 0); } mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags) { return mz_zip_reader_extract_file_to_mem_no_alloc(pZip, pFilename, pBuf, buf_size, flags, NULL, 0); } void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags) { mz_uint64 comp_size, uncomp_size, alloc_size; const mz_uint8 *p = mz_zip_reader_get_cdh(pZip, file_index); void *pBuf; if (pSize) *pSize = 0; if (!p) return NULL; comp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS); alloc_size = (flags & MZ_ZIP_FLAG_COMPRESSED_DATA) ? comp_size : uncomp_size; #ifdef _MSC_VER if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF)) #else if (((sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF)) #endif return NULL; if (NULL == (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)alloc_size))) return NULL; if (!mz_zip_reader_extract_to_mem(pZip, file_index, pBuf, (size_t)alloc_size, flags)) { pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); return NULL; } if (pSize) *pSize = (size_t)alloc_size; return pBuf; } void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags) { int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); if (file_index < 0) { if (pSize) *pSize = 0; return MZ_FALSE; } return mz_zip_reader_extract_to_heap(pZip, file_index, pSize, flags); } mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags) { int status = TINFL_STATUS_DONE; mz_uint file_crc32 = MZ_CRC32_INIT; mz_uint64 read_buf_size, read_buf_ofs = 0, read_buf_avail, comp_remaining, out_buf_ofs = 0, cur_file_ofs; mz_zip_archive_file_stat file_stat; void *pRead_buf = NULL; void *pWrite_buf = NULL; mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32; if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) return MZ_FALSE; // Empty file, or a directory (but not always a directory - I've seen odd zips with directories that have compressed data which inflates to 0 bytes) if (!file_stat.m_comp_size) return MZ_TRUE; // Entry is a subdirectory (I've seen old zips with dir entries which have compressed deflate data which inflates to 0 bytes, but these entries claim to uncompress to 512 bytes in the headers). // I'm torn how to handle this case - should it fail instead? if (mz_zip_reader_is_file_a_directory(pZip, file_index)) return MZ_TRUE; // Encryption and patch files are not supported. if (file_stat.m_bit_flag & (1 | 32)) return MZ_FALSE; // This function only supports stored and deflate. if ((!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (file_stat.m_method != 0) && (file_stat.m_method != MZ_DEFLATED)) return MZ_FALSE; // Read and parse the local directory entry. cur_file_ofs = file_stat.m_local_header_ofs; if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE) return MZ_FALSE; if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG) return MZ_FALSE; cur_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS); if ((cur_file_ofs + file_stat.m_comp_size) > pZip->m_archive_size) return MZ_FALSE; // Decompress the file either directly from memory or from a file input buffer. if (pZip->m_pState->m_pMem) { pRead_buf = (mz_uint8 *)pZip->m_pState->m_pMem + cur_file_ofs; read_buf_size = read_buf_avail = file_stat.m_comp_size; comp_remaining = 0; } else { read_buf_size = MZ_MIN(file_stat.m_comp_size, MZ_ZIP_MAX_IO_BUF_SIZE); if (NULL == (pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)read_buf_size))) return MZ_FALSE; read_buf_avail = 0; comp_remaining = file_stat.m_comp_size; } if ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!file_stat.m_method)) { // The file is stored or the caller has requested the compressed data. if (pZip->m_pState->m_pMem) { #ifdef _MSC_VER if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (file_stat.m_comp_size > 0xFFFFFFFF)) #else if (((sizeof(size_t) == sizeof(mz_uint32))) && (file_stat.m_comp_size > 0xFFFFFFFF)) #endif return MZ_FALSE; if (pCallback(pOpaque, out_buf_ofs, pRead_buf, (size_t)file_stat.m_comp_size) != file_stat.m_comp_size) status = TINFL_STATUS_FAILED; else if (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) file_crc32 = (mz_uint32)mz_crc32(file_crc32, (const mz_uint8 *)pRead_buf, (size_t)file_stat.m_comp_size); cur_file_ofs += file_stat.m_comp_size; out_buf_ofs += file_stat.m_comp_size; comp_remaining = 0; } else { while (comp_remaining) { read_buf_avail = MZ_MIN(read_buf_size, comp_remaining); if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail) { status = TINFL_STATUS_FAILED; break; } if (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) file_crc32 = (mz_uint32)mz_crc32(file_crc32, (const mz_uint8 *)pRead_buf, (size_t)read_buf_avail); if (pCallback(pOpaque, out_buf_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail) { status = TINFL_STATUS_FAILED; break; } cur_file_ofs += read_buf_avail; out_buf_ofs += read_buf_avail; comp_remaining -= read_buf_avail; } } } else { tinfl_decompressor inflator; tinfl_init(&inflator); if (NULL == (pWrite_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, TINFL_LZ_DICT_SIZE))) status = TINFL_STATUS_FAILED; else { do { mz_uint8 *pWrite_buf_cur = (mz_uint8 *)pWrite_buf + (out_buf_ofs & (TINFL_LZ_DICT_SIZE - 1)); size_t in_buf_size, out_buf_size = TINFL_LZ_DICT_SIZE - (out_buf_ofs & (TINFL_LZ_DICT_SIZE - 1)); if ((!read_buf_avail) && (!pZip->m_pState->m_pMem)) { read_buf_avail = MZ_MIN(read_buf_size, comp_remaining); if (pZip->m_pRead(pZip->m_pIO_opaque, cur_file_ofs, pRead_buf, (size_t)read_buf_avail) != read_buf_avail) { status = TINFL_STATUS_FAILED; break; } cur_file_ofs += read_buf_avail; comp_remaining -= read_buf_avail; read_buf_ofs = 0; } in_buf_size = (size_t)read_buf_avail; status = tinfl_decompress(&inflator, (const mz_uint8 *)pRead_buf + read_buf_ofs, &in_buf_size, (mz_uint8 *)pWrite_buf, pWrite_buf_cur, &out_buf_size, comp_remaining ? TINFL_FLAG_HAS_MORE_INPUT : 0); read_buf_avail -= in_buf_size; read_buf_ofs += in_buf_size; if (out_buf_size) { if (pCallback(pOpaque, out_buf_ofs, pWrite_buf_cur, out_buf_size) != out_buf_size) { status = TINFL_STATUS_FAILED; break; } file_crc32 = (mz_uint32)mz_crc32(file_crc32, pWrite_buf_cur, out_buf_size); if ((out_buf_ofs += out_buf_size) > file_stat.m_uncomp_size) { status = TINFL_STATUS_FAILED; break; } } } while ((status == TINFL_STATUS_NEEDS_MORE_INPUT) || (status == TINFL_STATUS_HAS_MORE_OUTPUT)); } } if ((status == TINFL_STATUS_DONE) && (!(flags & MZ_ZIP_FLAG_COMPRESSED_DATA))) { // Make sure the entire file was decompressed, and check its CRC. if ((out_buf_ofs != file_stat.m_uncomp_size) || (file_crc32 != file_stat.m_crc32)) status = TINFL_STATUS_FAILED; } if (!pZip->m_pState->m_pMem) pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); if (pWrite_buf) pZip->m_pFree(pZip->m_pAlloc_opaque, pWrite_buf); return status == TINFL_STATUS_DONE; } mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags) { int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags); if (file_index < 0) return MZ_FALSE; return mz_zip_reader_extract_to_callback(pZip, file_index, pCallback, pOpaque, flags); } #ifndef MINIZ_NO_STDIO static size_t mz_zip_file_write_callback(void *pOpaque, mz_uint64 ofs, const void *pBuf, size_t n) { (void)ofs; return MZ_FWRITE(pBuf, 1, n, (MZ_FILE*)pOpaque); } mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags) { mz_bool status; mz_zip_archive_file_stat file_stat; MZ_FILE *pFile; if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat)) return MZ_FALSE; pFile = MZ_FOPEN(pDst_filename, "wb"); if (!pFile) return MZ_FALSE; status = mz_zip_reader_extract_to_callback(pZip, file_index, mz_zip_file_write_callback, pFile, flags); if (MZ_FCLOSE(pFile) == EOF) return MZ_FALSE; #ifndef MINIZ_NO_TIME if (status) mz_zip_set_file_times(pDst_filename, file_stat.m_time, file_stat.m_time); #endif return status; } #endif // #ifndef MINIZ_NO_STDIO mz_bool mz_zip_reader_end(mz_zip_archive *pZip) { if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) return MZ_FALSE; if (pZip->m_pState) { mz_zip_internal_state *pState = pZip->m_pState; pZip->m_pState = NULL; mz_zip_array_clear(pZip, &pState->m_central_dir); mz_zip_array_clear(pZip, &pState->m_central_dir_offsets); mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets); #ifndef MINIZ_NO_STDIO if (pState->m_pFile) { MZ_FCLOSE(pState->m_pFile); pState->m_pFile = NULL; } #endif // #ifndef MINIZ_NO_STDIO pZip->m_pFree(pZip->m_pAlloc_opaque, pState); } pZip->m_zip_mode = MZ_ZIP_MODE_INVALID; return MZ_TRUE; } #ifndef MINIZ_NO_STDIO mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags) { int file_index = mz_zip_reader_locate_file(pZip, pArchive_filename, NULL, flags); if (file_index < 0) return MZ_FALSE; return mz_zip_reader_extract_to_file(pZip, file_index, pDst_filename, flags); } #endif // ------------------- .ZIP archive writing #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS static void mz_write_le16(mz_uint8 *p, mz_uint16 v) { p[0] = (mz_uint8)v; p[1] = (mz_uint8)(v >> 8); } static void mz_write_le32(mz_uint8 *p, mz_uint32 v) { p[0] = (mz_uint8)v; p[1] = (mz_uint8)(v >> 8); p[2] = (mz_uint8)(v >> 16); p[3] = (mz_uint8)(v >> 24); } #define MZ_WRITE_LE16(p, v) mz_write_le16((mz_uint8 *)(p), (mz_uint16)(v)) #define MZ_WRITE_LE32(p, v) mz_write_le32((mz_uint8 *)(p), (mz_uint32)(v)) mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size) { if ((!pZip) || (pZip->m_pState) || (!pZip->m_pWrite) || (pZip->m_zip_mode != MZ_ZIP_MODE_INVALID)) return MZ_FALSE; if (pZip->m_file_offset_alignment) { // Ensure user specified file offset alignment is a power of 2. if (pZip->m_file_offset_alignment & (pZip->m_file_offset_alignment - 1)) return MZ_FALSE; } if (!pZip->m_pAlloc) pZip->m_pAlloc = def_alloc_func; if (!pZip->m_pFree) pZip->m_pFree = def_free_func; if (!pZip->m_pRealloc) pZip->m_pRealloc = def_realloc_func; pZip->m_zip_mode = MZ_ZIP_MODE_WRITING; pZip->m_archive_size = existing_size; pZip->m_central_directory_file_ofs = 0; pZip->m_total_files = 0; if (NULL == (pZip->m_pState = (mz_zip_internal_state *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(mz_zip_internal_state)))) return MZ_FALSE; memset(pZip->m_pState, 0, sizeof(mz_zip_internal_state)); MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir, sizeof(mz_uint8)); MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_central_dir_offsets, sizeof(mz_uint32)); MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(&pZip->m_pState->m_sorted_central_dir_offsets, sizeof(mz_uint32)); return MZ_TRUE; } static size_t mz_zip_heap_write_func(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n) { mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; mz_zip_internal_state *pState = pZip->m_pState; mz_uint64 new_size = MZ_MAX(file_ofs + n, pState->m_mem_size); #ifdef _MSC_VER if ((!n) || ((0, sizeof(size_t) == sizeof(mz_uint32)) && (new_size > 0x7FFFFFFF))) #else if ((!n) || ((sizeof(size_t) == sizeof(mz_uint32)) && (new_size > 0x7FFFFFFF))) #endif return 0; if (new_size > pState->m_mem_capacity) { void *pNew_block; size_t new_capacity = MZ_MAX(64, pState->m_mem_capacity); while (new_capacity < new_size) new_capacity *= 2; if (NULL == (pNew_block = pZip->m_pRealloc(pZip->m_pAlloc_opaque, pState->m_pMem, 1, new_capacity))) return 0; pState->m_pMem = pNew_block; pState->m_mem_capacity = new_capacity; } memcpy((mz_uint8 *)pState->m_pMem + file_ofs, pBuf, n); pState->m_mem_size = (size_t)new_size; return n; } mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size) { pZip->m_pWrite = mz_zip_heap_write_func; pZip->m_pIO_opaque = pZip; if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning)) return MZ_FALSE; if (0 != (initial_allocation_size = MZ_MAX(initial_allocation_size, size_to_reserve_at_beginning))) { if (NULL == (pZip->m_pState->m_pMem = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, initial_allocation_size))) { mz_zip_writer_end(pZip); return MZ_FALSE; } pZip->m_pState->m_mem_capacity = initial_allocation_size; } return MZ_TRUE; } #ifndef MINIZ_NO_STDIO static size_t mz_zip_file_write_func(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n) { mz_zip_archive *pZip = (mz_zip_archive *)pOpaque; mz_int64 cur_ofs = MZ_FTELL64(pZip->m_pState->m_pFile); if (((mz_int64)file_ofs < 0) || (((cur_ofs != (mz_int64)file_ofs)) && (MZ_FSEEK64(pZip->m_pState->m_pFile, (mz_int64)file_ofs, SEEK_SET)))) return 0; return MZ_FWRITE(pBuf, 1, n, pZip->m_pState->m_pFile); } mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning) { MZ_FILE *pFile; pZip->m_pWrite = mz_zip_file_write_func; pZip->m_pIO_opaque = pZip; if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning)) return MZ_FALSE; if (NULL == (pFile = MZ_FOPEN(pFilename, "wb"))) { mz_zip_writer_end(pZip); return MZ_FALSE; } pZip->m_pState->m_pFile = pFile; if (size_to_reserve_at_beginning) { mz_uint64 cur_ofs = 0; char buf[4096]; MZ_CLEAR_OBJ(buf); do { size_t n = (size_t)MZ_MIN(sizeof(buf), size_to_reserve_at_beginning); if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_ofs, buf, n) != n) { mz_zip_writer_end(pZip); return MZ_FALSE; } cur_ofs += n; size_to_reserve_at_beginning -= n; } while (size_to_reserve_at_beginning); } return MZ_TRUE; } #endif // #ifndef MINIZ_NO_STDIO mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename) { mz_zip_internal_state *pState; if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_READING)) return MZ_FALSE; // No sense in trying to write to an archive that's already at the support max size if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + MZ_ZIP_LOCAL_DIR_HEADER_SIZE) > 0xFFFFFFFF)) return MZ_FALSE; pState = pZip->m_pState; if (pState->m_pFile) { #ifdef MINIZ_NO_STDIO pFilename; return MZ_FALSE; #else // Archive is being read from stdio - try to reopen as writable. if (pZip->m_pIO_opaque != pZip) return MZ_FALSE; if (!pFilename) return MZ_FALSE; pZip->m_pWrite = mz_zip_file_write_func; if (NULL == (pState->m_pFile = MZ_FREOPEN(pFilename, "r+b", pState->m_pFile))) { // The mz_zip_archive is now in a bogus state because pState->m_pFile is NULL, so just close it. mz_zip_reader_end(pZip); return MZ_FALSE; } #endif // #ifdef MINIZ_NO_STDIO } else if (pState->m_pMem) { // Archive lives in a memory block. Assume it's from the heap that we can resize using the realloc callback. if (pZip->m_pIO_opaque != pZip) return MZ_FALSE; pState->m_mem_capacity = pState->m_mem_size; pZip->m_pWrite = mz_zip_heap_write_func; } // Archive is being read via a user provided read function - make sure the user has specified a write function too. else if (!pZip->m_pWrite) return MZ_FALSE; // Start writing new files at the archive's current central directory location. pZip->m_archive_size = pZip->m_central_directory_file_ofs; pZip->m_zip_mode = MZ_ZIP_MODE_WRITING; pZip->m_central_directory_file_ofs = 0; return MZ_TRUE; } mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags) { return mz_zip_writer_add_mem_ex(pZip, pArchive_name, pBuf, buf_size, NULL, 0, level_and_flags, 0, 0); } typedef struct { mz_zip_archive *m_pZip; mz_uint64 m_cur_archive_file_ofs; mz_uint64 m_comp_size; } mz_zip_writer_add_state; static mz_bool mz_zip_writer_add_put_buf_callback(const void* pBuf, int len, void *pUser) { mz_zip_writer_add_state *pState = (mz_zip_writer_add_state *)pUser; if ((int)pState->m_pZip->m_pWrite(pState->m_pZip->m_pIO_opaque, pState->m_cur_archive_file_ofs, pBuf, len) != len) return MZ_FALSE; pState->m_cur_archive_file_ofs += len; pState->m_comp_size += len; return MZ_TRUE; } static mz_bool mz_zip_writer_create_local_dir_header(mz_zip_archive *pZip, mz_uint8 *pDst, mz_uint16 filename_size, mz_uint16 extra_size, mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date) { (void)pZip; memset(pDst, 0, MZ_ZIP_LOCAL_DIR_HEADER_SIZE); MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_SIG_OFS, MZ_ZIP_LOCAL_DIR_HEADER_SIG); MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_VERSION_NEEDED_OFS, method ? 20 : 0); MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_BIT_FLAG_OFS, bit_flags); MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_METHOD_OFS, method); MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILE_TIME_OFS, dos_time); MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILE_DATE_OFS, dos_date); MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_CRC32_OFS, uncomp_crc32); MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_COMPRESSED_SIZE_OFS, comp_size); MZ_WRITE_LE32(pDst + MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS, uncomp_size); MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_FILENAME_LEN_OFS, filename_size); MZ_WRITE_LE16(pDst + MZ_ZIP_LDH_EXTRA_LEN_OFS, extra_size); return MZ_TRUE; } static mz_bool mz_zip_writer_create_central_dir_header(mz_zip_archive *pZip, mz_uint8 *pDst, mz_uint16 filename_size, mz_uint16 extra_size, mz_uint16 comment_size, mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date, mz_uint64 local_header_ofs, mz_uint32 ext_attributes) { (void)pZip; memset(pDst, 0, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE); MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_SIG_OFS, MZ_ZIP_CENTRAL_DIR_HEADER_SIG); MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_VERSION_NEEDED_OFS, method ? 20 : 0); MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_BIT_FLAG_OFS, bit_flags); MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_METHOD_OFS, method); MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILE_TIME_OFS, dos_time); MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILE_DATE_OFS, dos_date); MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_CRC32_OFS, uncomp_crc32); MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS, comp_size); MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS, uncomp_size); MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_FILENAME_LEN_OFS, filename_size); MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_EXTRA_LEN_OFS, extra_size); MZ_WRITE_LE16(pDst + MZ_ZIP_CDH_COMMENT_LEN_OFS, comment_size); MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_EXTERNAL_ATTR_OFS, ext_attributes); MZ_WRITE_LE32(pDst + MZ_ZIP_CDH_LOCAL_HEADER_OFS, local_header_ofs); return MZ_TRUE; } static mz_bool mz_zip_writer_add_to_central_dir(mz_zip_archive *pZip, const char *pFilename, mz_uint16 filename_size, const void *pExtra, mz_uint16 extra_size, const void *pComment, mz_uint16 comment_size, mz_uint64 uncomp_size, mz_uint64 comp_size, mz_uint32 uncomp_crc32, mz_uint16 method, mz_uint16 bit_flags, mz_uint16 dos_time, mz_uint16 dos_date, mz_uint64 local_header_ofs, mz_uint32 ext_attributes) { mz_zip_internal_state *pState = pZip->m_pState; mz_uint32 central_dir_ofs = (mz_uint32)pState->m_central_dir.m_size; size_t orig_central_dir_size = pState->m_central_dir.m_size; mz_uint8 central_dir_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE]; // No zip64 support yet if ((local_header_ofs > 0xFFFFFFFF) || (((mz_uint64)pState->m_central_dir.m_size + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + filename_size + extra_size + comment_size) > 0xFFFFFFFF)) return MZ_FALSE; if (!mz_zip_writer_create_central_dir_header(pZip, central_dir_header, filename_size, extra_size, comment_size, uncomp_size, comp_size, uncomp_crc32, method, bit_flags, dos_time, dos_date, local_header_ofs, ext_attributes)) return MZ_FALSE; if ((!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_dir_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)) || (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pFilename, filename_size)) || (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pExtra, extra_size)) || (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pComment, comment_size)) || (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &central_dir_ofs, 1))) { // Try to push the central directory array back into its original state. mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE); return MZ_FALSE; } return MZ_TRUE; } static mz_bool mz_zip_writer_validate_archive_name(const char *pArchive_name) { // Basic ZIP archive filename validity checks: Valid filenames cannot start with a forward slash, cannot contain a drive letter, and cannot use DOS-style backward slashes. if (*pArchive_name == '/') return MZ_FALSE; while (*pArchive_name) { if ((*pArchive_name == '\\') || (*pArchive_name == ':')) return MZ_FALSE; pArchive_name++; } return MZ_TRUE; } static mz_uint mz_zip_writer_compute_padding_needed_for_file_alignment(mz_zip_archive *pZip) { mz_uint32 n; if (!pZip->m_file_offset_alignment) return 0; n = (mz_uint32)(pZip->m_archive_size & (pZip->m_file_offset_alignment - 1)); return (pZip->m_file_offset_alignment - n) & (pZip->m_file_offset_alignment - 1); } static mz_bool mz_zip_writer_write_zeros(mz_zip_archive *pZip, mz_uint64 cur_file_ofs, mz_uint32 n) { char buf[4096]; memset(buf, 0, MZ_MIN(sizeof(buf), n)); while (n) { mz_uint32 s = MZ_MIN(sizeof(buf), n); if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_file_ofs, buf, s) != s) return MZ_FALSE; cur_file_ofs += s; n -= s; } return MZ_TRUE; } mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32) { mz_uint16 method = 0, dos_time = 0, dos_date = 0; mz_uint level, ext_attributes = 0, num_alignment_padding_bytes; mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size, comp_size = 0; size_t archive_name_size; mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE]; tdefl_compressor *pComp = NULL; mz_bool store_data_uncompressed; mz_zip_internal_state *pState; if ((int)level_and_flags < 0) level_and_flags = MZ_DEFAULT_LEVEL; level = level_and_flags & 0xF; store_data_uncompressed = ((!level) || (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)); if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || ((buf_size) && (!pBuf)) || (!pArchive_name) || ((comment_size) && (!pComment)) || (pZip->m_total_files == 0xFFFF) || (level > MZ_UBER_COMPRESSION)) return MZ_FALSE; pState = pZip->m_pState; if ((!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (uncomp_size)) return MZ_FALSE; // No zip64 support yet if ((buf_size > 0xFFFFFFFF) || (uncomp_size > 0xFFFFFFFF)) return MZ_FALSE; if (!mz_zip_writer_validate_archive_name(pArchive_name)) return MZ_FALSE; #ifndef MINIZ_NO_TIME { time_t cur_time; time(&cur_time); mz_zip_time_to_dos_time(cur_time, &dos_time, &dos_date); } #endif // #ifndef MINIZ_NO_TIME archive_name_size = strlen(pArchive_name); if (archive_name_size > 0xFFFF) return MZ_FALSE; num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); // no zip64 support yet if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + comment_size + archive_name_size) > 0xFFFFFFFF)) return MZ_FALSE; if ((archive_name_size) && (pArchive_name[archive_name_size - 1] == '/')) { // Set DOS Subdirectory attribute bit. ext_attributes |= 0x10; // Subdirectories cannot contain data. if ((buf_size) || (uncomp_size)) return MZ_FALSE; } // Try to do any allocations before writing to the archive, so if an allocation fails the file remains unmodified. (A good idea if we're doing an in-place modification.) if ((!mz_zip_array_ensure_room(pZip, &pState->m_central_dir, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + archive_name_size + comment_size)) || (!mz_zip_array_ensure_room(pZip, &pState->m_central_dir_offsets, 1))) return MZ_FALSE; if ((!store_data_uncompressed) && (buf_size)) { if (NULL == (pComp = (tdefl_compressor *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(tdefl_compressor)))) return MZ_FALSE; } if (!mz_zip_writer_write_zeros(pZip, cur_archive_file_ofs, num_alignment_padding_bytes + sizeof(local_dir_header))) { pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); return MZ_FALSE; } local_dir_header_ofs += num_alignment_padding_bytes; if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); } cur_archive_file_ofs += num_alignment_padding_bytes + sizeof(local_dir_header); MZ_CLEAR_OBJ(local_dir_header); if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, archive_name_size) != archive_name_size) { pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); return MZ_FALSE; } cur_archive_file_ofs += archive_name_size; if (!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) { uncomp_crc32 = (mz_uint32)mz_crc32(MZ_CRC32_INIT, (const mz_uint8*)pBuf, buf_size); uncomp_size = buf_size; if (uncomp_size <= 3) { level = 0; store_data_uncompressed = MZ_TRUE; } } if (store_data_uncompressed) { if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pBuf, buf_size) != buf_size) { pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); return MZ_FALSE; } cur_archive_file_ofs += buf_size; comp_size = buf_size; if (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA) method = MZ_DEFLATED; } else if (buf_size) { mz_zip_writer_add_state state; state.m_pZip = pZip; state.m_cur_archive_file_ofs = cur_archive_file_ofs; state.m_comp_size = 0; if ((tdefl_init(pComp, mz_zip_writer_add_put_buf_callback, &state, tdefl_create_comp_flags_from_zip_params(level, -15, MZ_DEFAULT_STRATEGY)) != TDEFL_STATUS_OKAY) || (tdefl_compress_buffer(pComp, pBuf, buf_size, TDEFL_FINISH) != TDEFL_STATUS_DONE)) { pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); return MZ_FALSE; } comp_size = state.m_comp_size; cur_archive_file_ofs = state.m_cur_archive_file_ofs; method = MZ_DEFLATED; } pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); pComp = NULL; // no zip64 support yet if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF)) return MZ_FALSE; if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date)) return MZ_FALSE; if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header)) return MZ_FALSE; if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date, local_dir_header_ofs, ext_attributes)) return MZ_FALSE; pZip->m_total_files++; pZip->m_archive_size = cur_archive_file_ofs; return MZ_TRUE; } #ifndef MINIZ_NO_STDIO mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags) { mz_uint uncomp_crc32 = MZ_CRC32_INIT, level, num_alignment_padding_bytes; mz_uint16 method = 0, dos_time = 0, dos_date = 0, ext_attributes = 0; mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size, uncomp_size = 0, comp_size = 0; size_t archive_name_size; mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE]; MZ_FILE *pSrc_file = NULL; if ((int)level_and_flags < 0) level_and_flags = MZ_DEFAULT_LEVEL; level = level_and_flags & 0xF; if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || (!pArchive_name) || ((comment_size) && (!pComment)) || (level > MZ_UBER_COMPRESSION)) return MZ_FALSE; if (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA) return MZ_FALSE; if (!mz_zip_writer_validate_archive_name(pArchive_name)) return MZ_FALSE; archive_name_size = strlen(pArchive_name); if (archive_name_size > 0xFFFF) return MZ_FALSE; num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); // no zip64 support yet if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + comment_size + archive_name_size) > 0xFFFFFFFF)) return MZ_FALSE; if (!mz_zip_get_file_modified_time(pSrc_filename, &dos_time, &dos_date)) return MZ_FALSE; pSrc_file = MZ_FOPEN(pSrc_filename, "rb"); if (!pSrc_file) return MZ_FALSE; MZ_FSEEK64(pSrc_file, 0, SEEK_END); uncomp_size = MZ_FTELL64(pSrc_file); MZ_FSEEK64(pSrc_file, 0, SEEK_SET); if (uncomp_size > 0xFFFFFFFF) { // No zip64 support yet MZ_FCLOSE(pSrc_file); return MZ_FALSE; } if (uncomp_size <= 3) level = 0; if (!mz_zip_writer_write_zeros(pZip, cur_archive_file_ofs, num_alignment_padding_bytes + sizeof(local_dir_header))) { MZ_FCLOSE(pSrc_file); return MZ_FALSE; } local_dir_header_ofs += num_alignment_padding_bytes; if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); } cur_archive_file_ofs += num_alignment_padding_bytes + sizeof(local_dir_header); MZ_CLEAR_OBJ(local_dir_header); if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, archive_name_size) != archive_name_size) { MZ_FCLOSE(pSrc_file); return MZ_FALSE; } cur_archive_file_ofs += archive_name_size; if (uncomp_size) { mz_uint64 uncomp_remaining = uncomp_size; void *pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, MZ_ZIP_MAX_IO_BUF_SIZE); if (!pRead_buf) { MZ_FCLOSE(pSrc_file); return MZ_FALSE; } if (!level) { while (uncomp_remaining) { mz_uint n = (mz_uint)MZ_MIN(MZ_ZIP_MAX_IO_BUF_SIZE, uncomp_remaining); if ((MZ_FREAD(pRead_buf, 1, n, pSrc_file) != n) || (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pRead_buf, n) != n)) { pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); MZ_FCLOSE(pSrc_file); return MZ_FALSE; } uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, n); uncomp_remaining -= n; cur_archive_file_ofs += n; } comp_size = uncomp_size; } else { mz_bool result = MZ_FALSE; mz_zip_writer_add_state state; tdefl_compressor *pComp = (tdefl_compressor *)pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, sizeof(tdefl_compressor)); if (!pComp) { pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); MZ_FCLOSE(pSrc_file); return MZ_FALSE; } state.m_pZip = pZip; state.m_cur_archive_file_ofs = cur_archive_file_ofs; state.m_comp_size = 0; if (tdefl_init(pComp, mz_zip_writer_add_put_buf_callback, &state, tdefl_create_comp_flags_from_zip_params(level, -15, MZ_DEFAULT_STRATEGY)) != TDEFL_STATUS_OKAY) { pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); MZ_FCLOSE(pSrc_file); return MZ_FALSE; } for ( ; ; ) { size_t in_buf_size = (mz_uint32)MZ_MIN(uncomp_remaining, MZ_ZIP_MAX_IO_BUF_SIZE); tdefl_status status; if (MZ_FREAD(pRead_buf, 1, in_buf_size, pSrc_file) != in_buf_size) break; uncomp_crc32 = (mz_uint32)mz_crc32(uncomp_crc32, (const mz_uint8 *)pRead_buf, in_buf_size); uncomp_remaining -= in_buf_size; status = tdefl_compress_buffer(pComp, pRead_buf, in_buf_size, uncomp_remaining ? TDEFL_NO_FLUSH : TDEFL_FINISH); if (status == TDEFL_STATUS_DONE) { result = MZ_TRUE; break; } else if (status != TDEFL_STATUS_OKAY) break; } pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); if (!result) { pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); MZ_FCLOSE(pSrc_file); return MZ_FALSE; } comp_size = state.m_comp_size; cur_archive_file_ofs = state.m_cur_archive_file_ofs; method = MZ_DEFLATED; } pZip->m_pFree(pZip->m_pAlloc_opaque, pRead_buf); } MZ_FCLOSE(pSrc_file); pSrc_file = NULL; // no zip64 support yet if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF)) return MZ_FALSE; if (!mz_zip_writer_create_local_dir_header(pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date)) return MZ_FALSE; if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header)) return MZ_FALSE; if (!mz_zip_writer_add_to_central_dir(pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date, local_dir_header_ofs, ext_attributes)) return MZ_FALSE; pZip->m_total_files++; pZip->m_archive_size = cur_archive_file_ofs; return MZ_TRUE; } #endif // #ifndef MINIZ_NO_STDIO mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint file_index) { mz_uint n, bit_flags, num_alignment_padding_bytes; mz_uint64 comp_bytes_remaining, local_dir_header_ofs; mz_uint64 cur_src_file_ofs, cur_dst_file_ofs; mz_uint32 local_header_u32[(MZ_ZIP_LOCAL_DIR_HEADER_SIZE + sizeof(mz_uint32) - 1) / sizeof(mz_uint32)]; mz_uint8 *pLocal_header = (mz_uint8 *)local_header_u32; mz_uint8 central_header[MZ_ZIP_CENTRAL_DIR_HEADER_SIZE]; size_t orig_central_dir_size; mz_zip_internal_state *pState; void *pBuf; const mz_uint8 *pSrc_central_header; if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING)) return MZ_FALSE; if (NULL == (pSrc_central_header = mz_zip_reader_get_cdh(pSource_zip, file_index))) return MZ_FALSE; pState = pZip->m_pState; num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); // no zip64 support yet if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE) > 0xFFFFFFFF)) return MZ_FALSE; cur_src_file_ofs = MZ_READ_LE32(pSrc_central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS); cur_dst_file_ofs = pZip->m_archive_size; if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE) return MZ_FALSE; if (MZ_READ_LE32(pLocal_header) != MZ_ZIP_LOCAL_DIR_HEADER_SIG) return MZ_FALSE; cur_src_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE; if (!mz_zip_writer_write_zeros(pZip, cur_dst_file_ofs, num_alignment_padding_bytes)) return MZ_FALSE; cur_dst_file_ofs += num_alignment_padding_bytes; local_dir_header_ofs = cur_dst_file_ofs; if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); } if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pLocal_header, MZ_ZIP_LOCAL_DIR_HEADER_SIZE) != MZ_ZIP_LOCAL_DIR_HEADER_SIZE) return MZ_FALSE; cur_dst_file_ofs += MZ_ZIP_LOCAL_DIR_HEADER_SIZE; n = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_EXTRA_LEN_OFS); comp_bytes_remaining = n + MZ_READ_LE32(pSrc_central_header + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS); if (NULL == (pBuf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)MZ_MAX(sizeof(mz_uint32) * 4, MZ_MIN(MZ_ZIP_MAX_IO_BUF_SIZE, comp_bytes_remaining))))) return MZ_FALSE; while (comp_bytes_remaining) { n = (mz_uint)MZ_MIN(MZ_ZIP_MAX_IO_BUF_SIZE, comp_bytes_remaining); if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, n) != n) { pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); return MZ_FALSE; } cur_src_file_ofs += n; if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n) { pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); return MZ_FALSE; } cur_dst_file_ofs += n; comp_bytes_remaining -= n; } bit_flags = MZ_READ_LE16(pLocal_header + MZ_ZIP_LDH_BIT_FLAG_OFS); if (bit_flags & 8) { // Copy data descriptor if (pSource_zip->m_pRead(pSource_zip->m_pIO_opaque, cur_src_file_ofs, pBuf, sizeof(mz_uint32) * 4) != sizeof(mz_uint32) * 4) { pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); return MZ_FALSE; } n = sizeof(mz_uint32) * ((MZ_READ_LE32(pBuf) == 0x08074b50) ? 4 : 3); if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_dst_file_ofs, pBuf, n) != n) { pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); return MZ_FALSE; } cur_src_file_ofs += n; cur_dst_file_ofs += n; } pZip->m_pFree(pZip->m_pAlloc_opaque, pBuf); // no zip64 support yet if (cur_dst_file_ofs > 0xFFFFFFFF) return MZ_FALSE; orig_central_dir_size = pState->m_central_dir.m_size; memcpy(central_header, pSrc_central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE); MZ_WRITE_LE32(central_header + MZ_ZIP_CDH_LOCAL_HEADER_OFS, local_dir_header_ofs); if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, central_header, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE)) return MZ_FALSE; n = MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_FILENAME_LEN_OFS) + MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_EXTRA_LEN_OFS) + MZ_READ_LE16(pSrc_central_header + MZ_ZIP_CDH_COMMENT_LEN_OFS); if (!mz_zip_array_push_back(pZip, &pState->m_central_dir, pSrc_central_header + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE, n)) { mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE); return MZ_FALSE; } if (pState->m_central_dir.m_size > 0xFFFFFFFF) return MZ_FALSE; n = (mz_uint32)orig_central_dir_size; if (!mz_zip_array_push_back(pZip, &pState->m_central_dir_offsets, &n, 1)) { mz_zip_array_resize(pZip, &pState->m_central_dir, orig_central_dir_size, MZ_FALSE); return MZ_FALSE; } pZip->m_total_files++; pZip->m_archive_size = cur_dst_file_ofs; return MZ_TRUE; } mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip) { mz_zip_internal_state *pState; mz_uint64 central_dir_ofs, central_dir_size; mz_uint8 hdr[MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE]; if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING)) return MZ_FALSE; pState = pZip->m_pState; // no zip64 support yet if ((pZip->m_total_files > 0xFFFF) || ((pZip->m_archive_size + pState->m_central_dir.m_size + MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) > 0xFFFFFFFF)) return MZ_FALSE; central_dir_ofs = 0; central_dir_size = 0; if (pZip->m_total_files) { // Write central directory central_dir_ofs = pZip->m_archive_size; central_dir_size = pState->m_central_dir.m_size; pZip->m_central_directory_file_ofs = central_dir_ofs; if (pZip->m_pWrite(pZip->m_pIO_opaque, central_dir_ofs, pState->m_central_dir.m_p, (size_t)central_dir_size) != central_dir_size) return MZ_FALSE; pZip->m_archive_size += central_dir_size; } // Write end of central directory record MZ_CLEAR_OBJ(hdr); MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_SIG_OFS, MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG); MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS, pZip->m_total_files); MZ_WRITE_LE16(hdr + MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS, pZip->m_total_files); MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_CDIR_SIZE_OFS, central_dir_size); MZ_WRITE_LE32(hdr + MZ_ZIP_ECDH_CDIR_OFS_OFS, central_dir_ofs); if (pZip->m_pWrite(pZip->m_pIO_opaque, pZip->m_archive_size, hdr, sizeof(hdr)) != sizeof(hdr)) return MZ_FALSE; #ifndef MINIZ_NO_STDIO if ((pState->m_pFile) && (MZ_FFLUSH(pState->m_pFile) == EOF)) return MZ_FALSE; #endif // #ifndef MINIZ_NO_STDIO pZip->m_archive_size += sizeof(hdr); pZip->m_zip_mode = MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED; return MZ_TRUE; } mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, size_t *pSize) { if ((!pZip) || (!pZip->m_pState) || (!pBuf) || (!pSize)) return MZ_FALSE; if (pZip->m_pWrite != mz_zip_heap_write_func) return MZ_FALSE; if (!mz_zip_writer_finalize_archive(pZip)) return MZ_FALSE; *pBuf = pZip->m_pState->m_pMem; *pSize = pZip->m_pState->m_mem_size; pZip->m_pState->m_pMem = NULL; pZip->m_pState->m_mem_size = pZip->m_pState->m_mem_capacity = 0; return MZ_TRUE; } mz_bool mz_zip_writer_end(mz_zip_archive *pZip) { mz_zip_internal_state *pState; mz_bool status = MZ_TRUE; if ((!pZip) || (!pZip->m_pState) || (!pZip->m_pAlloc) || (!pZip->m_pFree) || ((pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) && (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED))) return MZ_FALSE; pState = pZip->m_pState; pZip->m_pState = NULL; mz_zip_array_clear(pZip, &pState->m_central_dir); mz_zip_array_clear(pZip, &pState->m_central_dir_offsets); mz_zip_array_clear(pZip, &pState->m_sorted_central_dir_offsets); #ifndef MINIZ_NO_STDIO if (pState->m_pFile) { MZ_FCLOSE(pState->m_pFile); pState->m_pFile = NULL; } #endif // #ifndef MINIZ_NO_STDIO if ((pZip->m_pWrite == mz_zip_heap_write_func) && (pState->m_pMem)) { pZip->m_pFree(pZip->m_pAlloc_opaque, pState->m_pMem); pState->m_pMem = NULL; } pZip->m_pFree(pZip->m_pAlloc_opaque, pState); pZip->m_zip_mode = MZ_ZIP_MODE_INVALID; return status; } #ifndef MINIZ_NO_STDIO mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags) { mz_bool status, created_new_archive = MZ_FALSE; mz_zip_archive zip_archive; struct MZ_FILE_STAT_STRUCT file_stat; MZ_CLEAR_OBJ(zip_archive); if ((int)level_and_flags < 0) level_and_flags = MZ_DEFAULT_LEVEL; if ((!pZip_filename) || (!pArchive_name) || ((buf_size) && (!pBuf)) || ((comment_size) && (!pComment)) || ((level_and_flags & 0xF) > MZ_UBER_COMPRESSION)) return MZ_FALSE; if (!mz_zip_writer_validate_archive_name(pArchive_name)) return MZ_FALSE; if (MZ_FILE_STAT(pZip_filename, &file_stat) != 0) { // Create a new archive. if (!mz_zip_writer_init_file(&zip_archive, pZip_filename, 0)) return MZ_FALSE; created_new_archive = MZ_TRUE; } else { // Append to an existing archive. if (!mz_zip_reader_init_file(&zip_archive, pZip_filename, level_and_flags | MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY)) return MZ_FALSE; if (!mz_zip_writer_init_from_reader(&zip_archive, pZip_filename)) { mz_zip_reader_end(&zip_archive); return MZ_FALSE; } } status = mz_zip_writer_add_mem_ex(&zip_archive, pArchive_name, pBuf, buf_size, pComment, comment_size, level_and_flags, 0, 0); // Always finalize, even if adding failed for some reason, so we have a valid central directory. (This may not always succeed, but we can try.) if (!mz_zip_writer_finalize_archive(&zip_archive)) status = MZ_FALSE; if (!mz_zip_writer_end(&zip_archive)) status = MZ_FALSE; if ((!status) && (created_new_archive)) { // It's a new archive and something went wrong, so just delete it. int ignoredStatus = MZ_DELETE_FILE(pZip_filename); (void)ignoredStatus; } return status; } void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint flags) { int file_index; mz_zip_archive zip_archive; void *p = NULL; if (pSize) *pSize = 0; if ((!pZip_filename) || (!pArchive_name)) return NULL; MZ_CLEAR_OBJ(zip_archive); if (!mz_zip_reader_init_file(&zip_archive, pZip_filename, flags | MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY)) return NULL; if ((file_index = mz_zip_reader_locate_file(&zip_archive, pArchive_name, NULL, flags)) >= 0) p = mz_zip_reader_extract_to_heap(&zip_archive, file_index, pSize, flags); mz_zip_reader_end(&zip_archive); return p; } #endif // #ifndef MINIZ_NO_STDIO #endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS #endif // #ifndef MINIZ_NO_ARCHIVE_APIS #ifdef __cplusplus } #endif #endif // MINIZ_HEADER_FILE_ONLY /* This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org/> */
the_stack_data/70449336.c
#include <stdio.h> #include <stdlib.h> typedef struct rows { int *array; int size, used; } row; int search(int, int *, int); void insert(row *, int); int main() { int n, i, j; scanf("%d", &n); int a[n][n]; for(i = 0; i < n; i++) for(j = 0; j < n; j++) scanf("%d", &a[i][j]); row **uniqrow = (row **) malloc(n*sizeof(row *)); row **uniqcol = (row **) malloc(n*sizeof(row *)); row matr = {(int *) malloc(sizeof(int)), 1, 0}; for(i = 0; i < n; i++) { row * newrow = (row *) malloc(sizeof(row *)); *newrow = (row){(int *) malloc(sizeof(int)), 1, 0}; row * newcol = (row *) malloc(sizeof(row *)); *newcol = (row){(int *) malloc(sizeof(int)), 1, 0}; *(uniqrow+i) = newrow; *(uniqcol+i) = newcol; for(j = 0; j < n; j++) { if(!search(a[i][j], newrow->array, newrow->used)) { if(newrow->size == newrow->used) { newrow->size *= 2; newrow->array = (int *) realloc(newrow->array, newrow->size*sizeof(int)); } insert(newrow, a[i][j]); newrow->used++; } if(!search(a[j][i], newcol->array, newcol->used)) { if(newcol->size == newcol->used) { newcol->size *= 2; newcol->array = (int *) realloc(newcol->array, newcol->size*sizeof(int)); } insert(newcol, a[j][i]); newcol->used++; } if(!search(a[i][j], matr.array, matr.used)) { if(matr.size == matr.used) { matr.size *= 2; matr.array = (int *) realloc(matr.array, matr.size*sizeof(int)); } insert(&matr, a[i][j]); matr.used++; } } } printf("Along rows:\n"); for(i = 0; i < n; i++) { row * cur = *(uniqrow+i); for(j = 0; j < cur->used; j++) printf("%d\t", *(cur->array+j)); printf("\n"); } printf("Along columns:\n"); for(i = 0; i < n; i++) { row * cur = *(uniqcol+i); for(j = 0; j < cur->used; j++) printf("%d\t", *(cur->array+j)); printf("\n"); } printf("Matrix:\n"); for(i = 0; i < matr.used; i++) printf("%d\t", *(matr.array+i)); printf("\n"); free(uniqrow); free(uniqcol); return 0; } int search(int value, int *arr, int end) { for(int i = 0; i < end; i++) if(*(arr+i) == value) return 1; return 0; } void insert(row * r, int value) { int i; for(i = r->used -1; i >= 0; i--) if(*(r->array+i)>value) *(r->array+i+1) = *(r->array+i); else break; *(r->array+i+1) = value; }
the_stack_data/43619.c
/* * fork_demo.c (c) 2018-20 Christopher A. Bohn */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> #include <sys/wait.h> #include <stdbool.h> #include <memory.h> #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunknown-pragmas" #pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection" /* void two_processes() { long j = 0; if(fork()) { // the parent process printf("A");fflush(stdout); printf("B");fflush(stdout); printf("C");fflush(stdout); printf("D");fflush(stdout); wait(NULL); printf("\n"); printf("%ld\n", j); } else { // the child process printf("E");fflush(stdout); printf("F");fflush(stdout); printf("G");fflush(stdout); printf("H");fflush(stdout); } } */ void fork_demo() { pid_t pid; printf("Before fork. \tme =%8d\tchild = n/a\tparent = %8d\n", getpid(), getppid()); pid = fork(); printf("After fork. \tme =%8d\tchild =%8d\tparent = %8d\n", getpid(), pid, getppid()); pid = fork(); printf("Another fork.\tme =%8d\tchild =%8d\tparent = %8d\n", getpid(), pid, getppid()); } void reap_children(); void sleep_and_exit(int exit_value); void wait_demo() { if (fork()) { // the parent process if (fork()) { reap_children(); } else { sleep_and_exit(1); } } else { // the child process sleep_and_exit(0); } } void reap_children() { pid_t pid; int status; while ((pid = wait(&status)) > 0) { if (WIFEXITED(status)) { printf("Process %d terminated with exit status %d.\n", pid, WEXITSTATUS(status)); } else { printf("Process %d terminated abnormally.\n", pid); } } if (errno == ECHILD) { printf("No more children.\n"); } else { printf("Unexpected error returned by wait().\n"); } } void waitpid_demo() { bool is_parent = true; int number_of_children = 4; int status; pid_t pid, pids[number_of_children]; for (int i = 0; i < number_of_children; i++) { pid = fork(); if (pid == 0) { is_parent = false; } else { pids[i] = pid; } } if (!is_parent) { sleep_and_exit(0); } else { long counter = 1; while ((pid = waitpid(pids[0], &status, WNOHANG)) == 0) { counter++; } printf("Process %d terminated after %ld calls to waitpid().\n", pid, counter); pid = waitpid(pids[1], &status, 0); printf("Process %d terminated.\n", pid); counter = 1; while ((pid = waitpid(-1, &status, WNOHANG)) == 0) { counter++; } printf("Process %d terminated after %ld calls to waitpid().\n", pid, counter); pid = waitpid(-1, &status, 0); printf("Process %d terminated.\n", pid); } } void sleep_and_exit(int exit_value) { sleep(1); exit(exit_value); } void fork_and_pipe(int *process, int *writing_fd, int *reading_fd0, int *reading_fd1, int *reading_fd2, int pipe_fd[4][2]); void pipe_demo() { int pipe_fd[4][2]; int process; int writing_fd, reading_fd0, reading_fd1, reading_fd2; const int size_of_buffer = 256; char buffer[size_of_buffer]; int integer_buffer[1]; fork_and_pipe(&process, &writing_fd, &reading_fd0, &reading_fd1, &reading_fd2, pipe_fd); switch (process) { case 0: printf("Process 0 is going to sleep...\n"); sleep(1); printf("Process 0 sending a message to process 1...\n"); write(writing_fd, "go!", 4); printf("Process 0 is waiting for process 1...\n"); read(reading_fd0, buffer, size_of_buffer); printf("Process 0 received a message from process1: %s\n", buffer); break; case 1: printf("Process 1 is waiting for process 0...\n"); read(reading_fd0, NULL, size_of_buffer); // we don't care what was written printf("Process 1 received a message from process 0.\n"); read(reading_fd1, integer_buffer, sizeof(int)); int value1 = integer_buffer[0]; printf("Process 1 received %d from process 2.\n", value1); read(reading_fd2, integer_buffer, sizeof(int)); int value2 = integer_buffer[0]; printf("Process 1 received %d from process 3.\n", value2); sprintf(buffer, "%d + %d = %d", value1, value2, value1 + value2); printf("Process 1 sending a message to process 0...\n"); write(writing_fd, buffer, strlen(buffer) + 1); break; case 2: integer_buffer[0] = 42; write(writing_fd, integer_buffer, sizeof(int)); break; case 3: integer_buffer[0] = 73; write(writing_fd, integer_buffer, sizeof(int)); break; default: printf("Process %d reached unreachable code; claims to be the %dth process.\n", getpid(), process); exit(-1); } // files should close when the process terminates, but we'll practice good hygiene anyway for (int i = 0; i < 4; i++) for (int j = 0; j < 2; j++) close(pipe_fd[i][j]); } void fork_and_pipe(int *process, int *writing_fd, int *reading_fd0, int *reading_fd1, int *reading_fd2, int pipe_fd[4][2]) { for (int i = 0; i < 4; i++) { pipe(pipe_fd[i]); } *process = 0; if (fork() == 0) { *process += 1; } if (fork() == 0) { *process += 2; } switch (*process) { case 0: *reading_fd0 = pipe_fd[1][0]; break; case 1: *reading_fd0 = pipe_fd[0][0]; *reading_fd1 = pipe_fd[2][0]; *reading_fd2 = pipe_fd[3][0]; break; case 2: case 3: // these processes won't read in this example break; default: printf("Process %d reached unreachable code; claims to be the %dth process.\n", getpid(), *process); exit(-1); } *writing_fd = pipe_fd[*process][1]; } int main() { // fork_demo(); // two_processes(); // wait_demo(); // waitpid_demo(); pipe_demo(); return 0; } #pragma clang diagnostic pop
the_stack_data/165766072.c
#include <stdio.h> struct Employee { unsigned int id; char name[256]; char gender; float salary; }; void addEmployee(FILE *f) { struct Employee emp; printf("Adding a new employee, please type his id \n"); int id; scanf("%d", &id); if (id > 0) { while (1) { //search if id already in use struct Employee tmp; fread(&tmp, sizeof(struct Employee), 1, f); if (feof(f) != 0) { //end of file emp.id = id; break; } if (id == tmp.id) { printf("Id already in use, id must be unique \n"); return; } else { emp.id = id; } } } else { printf("Id must be greater than 0 \n"); return; } printf("Please type his name \n"); scanf("%s", &emp.name); printf("Please type his gender (m or f) \n"); scanf(" %c", &emp.gender); if ((emp.gender != 'm') && (emp.gender != 'f')) { printf("Gender should be 'm' or 'f'"); return; } printf("Please type his salary \n"); scanf("%f", &emp.salary); fwrite(&emp, sizeof(struct Employee), 1, f); } void removeEmployee(FILE *f) { printf("Removing employee, please type his id \n"); int id; scanf("%d)", &id); while (1) { struct Employee tmp; fread(&tmp, sizeof(struct Employee), 1, f); if (feof(f) != 0) { printf("Employee not found"); return; } if (id == tmp.id) { fseek(f, -sizeof(struct Employee), SEEK_CUR); tmp.id = 0; fwrite(&tmp, sizeof(struct Employee), 1, f); printf("Sucess \n"); return; } } } void calculateAvarageSalaryByGender(FILE *f) { printf("Calculating the avarage salary by gender \n"); int maleNumber = 0; int femaleNumber = 0; float sumMale = 0; float sumFemale = 0; while (1) { struct Employee tmp; fread(&tmp, sizeof(struct Employee), 1, f); if (feof(f) != 0) break; if (tmp.id == 0) continue; if (tmp.gender == 'm') { maleNumber++; sumMale += tmp.salary; } else { femaleNumber++; sumFemale += tmp.salary; } } printf("Avarage male salary: %f \n", sumMale/maleNumber); printf("Avarage female salary: %f \n", sumFemale/femaleNumber); } void exportTextFile(FILE *f) { char path[256]; printf("Please type the name of the file to store the data \n"); scanf("%s)", &path); FILE *final; if ((final = fopen(path, "w")) == NULL) { printf("Error opening/creating the file"); } else { while (1) { struct Employee tmp; fread(&tmp, sizeof(struct Employee), 1, f); if (feof(f) != 0) break; if (tmp.id != 0) { fprintf(final, "ID: %d \n", tmp.id); fprintf(final, "Name: %s \n", tmp.name); fprintf(final, "Gender: %c \n", tmp.gender); fprintf(final, "Salary: %f \n", tmp.salary); } } } fclose(final); } void compactData(FILE *f, char fileName[]) { FILE *copy; if ((copy = fopen("copy", "wb")) == NULL) { printf("Error creating the copy file"); } else { while (1) { struct Employee tmp; fread(&tmp, sizeof(struct Employee), 1, f); if (feof(f) != 0) break; if (tmp.id != 0) { fwrite(&tmp, sizeof(struct Employee), 1, copy); } } fclose(copy); remove(fileName); rename("copy", fileName); } printf("Database compacted"); } int main(int argc, char *argv[]) { if (argc == 3) { int option = atoi(argv[2]); FILE *f; f = fopen(argv[1], "ab+"); fclose(f); switch(option) { case 1: if ((f = fopen(argv[1], "ab+")) == NULL) { printf("Error opening/creating the file"); } else { addEmployee(f); fclose(f); } break; case 2: if ((f = fopen(argv[1], "rb+")) == NULL) { printf("Error opening/creating the file"); } else { removeEmployee(f); fclose(f); } break; case 3: if ((f = fopen(argv[1], "rb")) == NULL) { printf("Error opening/creating the file"); } else { calculateAvarageSalaryByGender(f); fclose(f); } break; case 4: if ((f = fopen(argv[1], "rb")) == NULL) { printf("Error opening/creating the file"); } else { exportTextFile(f); fclose(f); } break; case 5: if ((f = fopen(argv[1], "rb")) == NULL) { printf("Error opening/creating the file"); } else { compactData(f, argv[1]); fclose(f); } break; } } else { printf("Need to provide two arguments, the first one is the binary file and second is the option. \n"); printf("1 - Add employee \n"); printf("2 - Remove employee \n"); printf("3 - Calculate avarage salary by gender \n"); printf("4 - Export data to a text file \n"); printf("5 - Compact data \n"); } return 0; }
the_stack_data/57949631.c
#define N 100 double fn5_d(double a1, double a2){ double tmp_a1,tmp_a2; double rtn = 0; if(a1 > 1000.0 && a2 > 1000.0){ tmp_a1 = a1 / 1000.0; tmp_a2 = a2 / 1000.0; }else if(a1 > 1000.0 || a2 > 1000.0){ if(a1 > a2){ tmp_a1 = a1 / 1000.0; }else{ tmp_a2 = a2 / 1000.0; } }else{ tmp_a1 = a1; tmp_a2 = a2; } if(tmp_a1 < 0) tmp_a1 = (-1.0) * tmp_a1; if(tmp_a2 < 0) tmp_a2 = (-1.0) * tmp_a2; tmp_a1 += 1.0; while(tmp_a1 > 100.0){ rtn += tmp_a2 / tmp_a1; tmp_a2 += 0.25; } return rtn; } int main(){ double result_d[N]; double start_d = 3.0; double tmp_d = 0; double a1,a2; int i; for(i=0; i<N; i++){ if(i==0){ tmp_d = fn5_d(start_d,10.0); result_d[i] = tmp_d; } else if(i==1){ a1 = result_d[0]; tmp_d = fn5_d(a1,a1); result_d[i] = tmp_d; } else{ a1 = result_d[i-1] - 0.334; a2 = result_d[i-2] - 0.72; if(a1 > a2){ tmp_d = fn5_d(a2,a1); } else{ tmp_d = fn5_d(a1,a2); } result_d[i] = tmp_d; } } return 0; }
the_stack_data/153267300.c
/** * Name: Charles Cash * Date: November 13, 2016 * Class: COP 2220 * Assignment: Rounding Numbers * Compiled with GCC on OSX */ #include <stdio.h> #include <math.h> #include <stdlib.h> /** * Rounds a number to an integer */ void roundToInteger(double num){ double* rounded = (double*) malloc(sizeof(double)); *rounded = floor(num + 0.5); printf("The rounded number is: %f\n", *rounded); return; } /** * Rounds a number to the tens place */ void roundToTenths(double num){ double* rounded = (double*) malloc(sizeof(double)); *rounded = floor((num/10) + 0.5) * 10; printf("The rounded number is: %f\n", *rounded); return; } /** * Rounds a number to the hundreds place */ void roundToHundredths(double num){ double* rounded = (double*) malloc(sizeof(double)); *rounded = floor((num/100) + 0.5) * 100; printf("The rounded number is: %f\n", *rounded); return; } /** * Rounds a number to the thousands place */ void roundToThousands(double num){ double* rounded = (double*) malloc(sizeof(double)); *rounded = floor((num/1000) + 0.5) * 1000; printf("The rounded number is: %f\n", *rounded); return; } /** * Main program loop * Creates initial memory -> Gets initial user input -> Does initial computationChosen * Reallocs mem -> Loops through doing computations until user elects to exit */ int main(void){ double* inputVal; int* computationChosen; inputVal = (double*) malloc(sizeof(double)); computationChosen = (int*) malloc(sizeof(int)); printf("Please enter a value: \n"); scanf("%lf", inputVal); printf("Please enter which rounding operation you wish to do:\n"); printf("1: Integer; 2: Tens; 3: Hundreds; 4: Thousands; 0: Exit\n"); scanf("%d", computationChosen); printf("Original Value: %f\n", *inputVal); switch(*computationChosen){ case 0: break; case 1: roundToInteger(*inputVal); break; case 2: roundToTenths(*inputVal); break; case 3: roundToHundredths(*inputVal); break; case 4: roundToThousands(*inputVal); break; } if(*computationChosen != 0){ computationChosen = (int*) realloc(computationChosen, sizeof(int)); printf("Please enter which rounding operation you wish to do:\n"); printf("1: Integer; 2: Tens; 3: Hundreds; 4: Thousands; 0: Exit\n"); scanf(" %d", computationChosen); while( *computationChosen != 0){ inputVal = (double*) realloc(inputVal, sizeof(int)); printf("Please enter a value: \n"); scanf("%lf", inputVal); printf("Original Value: %f\n", *inputVal); switch(*computationChosen){ case 0: break; case 1: roundToInteger(*inputVal); break; case 2: roundToTenths(*inputVal); break; case 3: roundToHundredths(*inputVal); break; case 4: roundToThousands(*inputVal); break; } printf("Please enter which rounding operation you wish to do:\n"); printf("1: Integer; 2: Tens; 3: Hundreds; 4: Thousands; 0: Exit\n"); scanf("%d", computationChosen); } } // Frees up memory free(inputVal); free(computationChosen); return 0; }
the_stack_data/111076805.c
#include <stdio.h> int main(int argc,char ** argv) { char buffer[1000]; printf("I am here%x,buffer%d\n",buffer,strlen(argv[1])); strcpy(buffer,argv[1]); return 0; }
the_stack_data/29108.c
/* This testcase is part of GDB, the GNU debugger. Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> struct s { int a; int b; }; union u { int a; float b; }; enum e { ONE = 1, TWO = 2 }; typedef struct s *PTR; enum e evalue = TWO; #ifdef __cplusplus struct Base { virtual int x() { return 5; } }; struct Derived : public Base { }; Base *base = new Derived (); void ptr_ref(int*& rptr_int) { return; /* break to inspect pointer by reference. */ } #endif void func1 () { printf ("void function called\n"); } int func2 (int arg1, int arg2) { return arg1 + arg2; } int main (int argc, char *argv[]) { char *cp = argv[0]; /* Prevent gcc from optimizing argv[] out. */ struct s s; union u u; PTR x = &s; char st[17] = "divide et impera"; char nullst[17] = "divide\0et\0impera"; void (*fp1) (void) = &func1; int (*fp2) (int, int) = &func2; const char *sptr = "pointer"; const char *embed = "embedded x\201\202\203\204"; int a[3] = {1,2,3}; int *p = a; int i = 2; int *ptr_i = &i; const char *sn = 0; s.a = 3; s.b = 5; u.a = 7; (*fp1) (); (*fp2) (10,20); #ifdef __cplusplus ptr_ref(ptr_i); #endif return 0; /* break to inspect struct and union */ }
the_stack_data/184518085.c
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/wait.h> #include <netdb.h> #define PORT 3490 /* 客户机连接远程主机的端口 */ #define MAXDATASIZE 100 /* 每次可以接收的最大字节 */ int main(int argc, char *argv[]) { int sockfd, numbytes; char buf[MAXDATASIZE]; struct hostent *he; struct sockaddr_in their_addr; /* connector's address information */ if (argc != 2) { fprintf(stderr,"usage: client hostname\n"); exit(1); } if ((he=gethostbyname(argv[1])) == NULL) { /* get the host info */ herror("gethostbyname"); exit(1); } if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { perror("socket"); exit(1); } their_addr.sin_family = AF_INET; /* host byte order */ their_addr.sin_port = htons(PORT); /* short, network byte order */ their_addr.sin_addr = *((struct in_addr *)he->h_addr); //their_addr.sin_addr.s_addr = inet_addr("xxx.xxx.xxx.xxx"); bzero(&(their_addr.sin_zero), sizeof(their_addr.sin_zero));/* zero the rest of the struct */ if (connect(sockfd, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1) { perror("connect"); exit(1); } if ((numbytes=recv(sockfd, buf, MAXDATASIZE, 0)) == -1) { perror("recv"); exit(1); } buf[numbytes] = '\0'; printf("Received: %s",buf); close(sockfd); return 0; }
the_stack_data/1198568.c
#include<stdio.h> main() { unsigned int a = 0xffff; a=~a; printf("%x %x %x",a,+ + a,a); }
the_stack_data/25139192.c
#include<stdio.h> /* Desenvolva um programa que calcule o aumento de um salário. Ele deve solicitar o valor do salário e a porcentagem do aumento. Exiba o valor do aumento e do novo salário. */ int main(){ float salario,aumento,porcent; printf("digite o valor do seu salario:\n "); scanf("%f",&salario); printf("digite em quantos porcento sera o aumento:\n "); scanf("%f",&aumento); porcent = (salario*(100+aumento))/100 ; printf("\no aumento foi de R$%.2f e o novo salario foi de R$%.2f \n",porcent-salario,porcent); }
the_stack_data/701709.c
#include <stdio.h> void foo(FILE *f) { fclose(f); } int main() { FILE *f; fclose(f); f = fopen("file.txt", "r"); foo(f); return 0; }
the_stack_data/120731.c
#include<stdio.h> #include<stdlib.h> int main(){ int n,P,F; while(scanf("%d %d", &P, &F)==2){ if(P == -1 && F == -1){ break; } n = abs(P-F); if(n > 50){ n= 100 - n; } printf("%d\n",n); } return 0; }
the_stack_data/28280.c
const unsigned char gImage_4[28800] = { /* 0X00,0X10,0X78,0X00,0X78,0X00,0X01,0X1B, */ 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF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XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, };
the_stack_data/95449739.c
/* drivers/gpu/arm/.../platform/gpu_hwcnt.c * * Copyright 2011 by S.LSI. Samsung Electronics Inc. * San#24, Nongseo-Dong, Giheung-Gu, Yongin, Korea * * Samsung SoC Mali-T Series DVFS driver * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software FoundatIon. */ /** * @file gpu_hwcnt.c * DVFS */ #ifdef MALI_SEC_HWCNT #include <mali_kbase.h> #include <mali_kbase_mem_linux.h> #include "mali_kbase_platform.h" #include "gpu_hwcnt.h" static inline unsigned long kbase_virt_to_phys(struct mm_struct *mm, unsigned long vaddr) { unsigned long *pgd; unsigned long *lv1d, *lv2d; pgd = (unsigned long *)mm->pgd; lv1d = pgd + (vaddr >> LV1_SHIFT); if ((*lv1d & LV1_DESC_MASK) != 0x1) { printk("invalid LV1 descriptor, " "pgd %p lv1d 0x%lx vaddr 0x%lx\n", pgd, *lv1d, vaddr); return 0; } lv2d = (unsigned long *)phys_to_virt(*lv1d & ~LV2_BASE_MASK) + ((vaddr & LV2_PT_MASK) >> LV2_SHIFT); if ((*lv2d & LV2_DESC_MASK) != 0x2) { printk("invalid LV2 descriptor, " "pgd %p lv2d 0x%lx vaddr 0x%lx\n", pgd, *lv2d, vaddr); return 0; } return (*lv2d & PAGE_MASK) | (vaddr & (PAGE_SIZE-1)); } static inline void* kbase_kmap_from_physical_address(struct kbase_device *kbdev) { return kmap(pfn_to_page(PFN_DOWN(kbdev->hwcnt.phy_addr))); } static inline void kbase_kunmap_from_physical_address(struct kbase_device *kbdev) { return kunmap(pfn_to_page(PFN_DOWN(kbdev->hwcnt.phy_addr))); } mali_error exynos_gpu_hwcnt_update(void *dev) { mali_error err = MALI_ERROR_FUNCTION_FAILED; struct kbase_device *kbdev; struct exynos_context *platform; kbdev = (struct kbase_device *)dev; platform = (struct exynos_context *) kbdev->platform_context; if ((!platform->hwcnt_gathering_status) || (kbdev->hwcnt.is_init != TRUE)) return err; mutex_lock(&kbdev->hwcnt.mlock); KBASE_DEBUG_ASSERT(kbdev); if ((!kbdev->hwcnt.enable_for_utilization) ||(!kbdev->hwcnt.is_init)) { err = MALI_ERROR_NONE; goto out; } if (kbdev->js_data.runpool_irq.secure_mode == MALI_TRUE) { err = MALI_ERROR_NONE; goto out; } #ifdef MALI_SEC_HWCNT_DUMP_DVFS_THREAD if (kbdev->hwcnt.is_powered && kbdev->hwcnt.kctx) { err = hwcnt_dump(kbdev->hwcnt.kctx); if (err != MALI_ERROR_NONE) { GPU_LOG(DVFS_INFO, DUMMY, 0u, 0u, "hwcnt dump error in %s %d \n", __FUNCTION__, err); goto out; } } #endif if (kbdev->hwcnt.is_powered && kbdev->hwcnt.kctx) { #ifdef CONFIG_MALI_DVFS_USER hwcnt_get_data(kbdev); #else hwcnt_get_utilization_resource(kbdev); #endif hwcnt_utilization_equation(kbdev); } else { hwcnt_value_clear(kbdev); } out: mutex_unlock(&kbdev->hwcnt.mlock); return err; } void hwcnt_value_clear(struct kbase_device *kbdev) { struct exynos_context *platform = (struct exynos_context *) kbdev->platform_context; platform->hwcnt_bt_clk = FALSE; kbdev->hwcnt.cnt_for_bt_start = 0; kbdev->hwcnt.cnt_for_bt_stop = 0; kbdev->hwcnt.resources.arith_words = 0; kbdev->hwcnt.resources.ls_issues = 0; kbdev->hwcnt.resources.tex_issues = 0; #ifdef CONFIG_MALI_DVFS_USER memset ((void*)&platform->hwc_data.data[0], 0, sizeof(platform->hwc_data)); #endif } void hwcnt_prepare_suspend(void *dev) { struct kbase_device *kbdev; kbdev = (struct kbase_device *)dev; if (kbdev->hwcnt.is_init) { struct exynos_context *platform = (struct exynos_context *) kbdev->platform_context; mutex_lock(&kbdev->hwcnt.mlock); kbdev->hwcnt.s_enable_for_utilization = kbdev->hwcnt.enable_for_utilization; kbdev->hwcnt.enable_for_utilization = FALSE; kbdev->hwcnt.enable_for_gpr = FALSE; kbdev->hwcnt.cnt_for_stop = 0; kbdev->hwcnt.cnt_for_bt_start = 0; kbdev->hwcnt.cnt_for_bt_stop = 0; platform->hwcnt_bt_clk = FALSE; /* Suspend any counter collection that might be happening */ if (kbdev->hwcnt.kctx) hwcnt_stop(kbdev); mutex_unlock(&kbdev->hwcnt.mlock); } } void hwcnt_prepare_resume(void *dev) { struct kbase_device *kbdev; kbdev = (struct kbase_device *)dev; if (kbdev->hwcnt.is_init) { mutex_lock(&kbdev->hwcnt.mlock); if ((kbdev->hwcnt.enable_for_gpr == FALSE) && (kbdev->hwcnt.s_enable_for_utilization)) kbdev->hwcnt.enable_for_utilization = TRUE; else kbdev->hwcnt.enable_for_utilization = FALSE; mutex_unlock(&kbdev->hwcnt.mlock); } } void hwcnt_utilization_equation(struct kbase_device *kbdev) { struct exynos_context *platform; int total_util; unsigned int debug_util; KBASE_DEBUG_ASSERT(kbdev); platform = (struct exynos_context *) kbdev->platform_context; GPU_LOG(DVFS_INFO, DUMMY, 0u, 0u, "%d, %d, %d\n", kbdev->hwcnt.resources.arith_words, kbdev->hwcnt.resources.ls_issues, kbdev->hwcnt.resources.tex_issues); total_util = kbdev->hwcnt.resources.arith_words * 25 + kbdev->hwcnt.resources.ls_issues * 40 + kbdev->hwcnt.resources.tex_issues * 35; debug_util = (kbdev->hwcnt.resources.arith_words << 24) | (kbdev->hwcnt.resources.ls_issues << 16) | (kbdev->hwcnt.resources.tex_issues << 8); if ((kbdev->hwcnt.resources.arith_words > 0) && (kbdev->hwcnt.resources.ls_issues == 0) && (kbdev->hwcnt.resources.tex_issues == 0)) { platform->hwcnt_bt_clk = FALSE; kbdev->hwcnt.cnt_for_bt_start = 0; memset(kbdev->hwcnt.acc_buffer, 0, HWC_ACC_BUFFER_SIZE); GPU_LOG(DVFS_WARNING, DUMMY, 0u, 0u, "hwcnt info (clock %d, voltage %d\n", platform->cur_clock, platform->cur_voltage); return; } if ((kbdev->hwcnt.resources.arith_words * 10 > kbdev->hwcnt.resources.ls_issues * 14) && (kbdev->hwcnt.resources.ls_issues < 40) && (total_util > 1000) && (total_util < 4800) && platform->cur_clock >= platform->gpu_max_clock_limit) { kbdev->hwcnt.cnt_for_bt_start++; kbdev->hwcnt.cnt_for_bt_stop = 0; if (kbdev->hwcnt.cnt_for_bt_start > 10) { platform->hwcnt_bt_clk = TRUE; kbdev->hwcnt.cnt_for_bt_start = 0; } } else { kbdev->hwcnt.cnt_for_bt_stop++; kbdev->hwcnt.cnt_for_bt_start = 0; if (kbdev->hwcnt.cnt_for_bt_stop > 5) { platform->hwcnt_bt_clk = FALSE; kbdev->hwcnt.cnt_for_bt_stop = 0; } } if (platform->hwcnt_bt_clk == TRUE) GPU_LOG(DVFS_INFO, LSI_HWCNT_BT_ON, 0u, debug_util, "hwcnt bt on\n"); else GPU_LOG(DVFS_INFO, LSI_HWCNT_BT_OFF, 0u, debug_util, "hwcnt bt off\n"); memset(kbdev->hwcnt.acc_buffer, 0, HWC_ACC_BUFFER_SIZE); } #ifdef CONFIG_MALI_DVFS_USER mali_error hwcnt_get_data(struct kbase_device *kbdev) { int i; int num_cores; int mem_offset; unsigned int *acc_addr, *data; struct exynos_context *platform = (struct exynos_context *) kbdev->platform_context; mali_error err = MALI_ERROR_FUNCTION_FAILED; if (kbdev->gpu_props.num_core_groups != 1) { /* num of core groups must be 1 on T76X */ return err; } acc_addr = (unsigned int*)kbdev->hwcnt.acc_buffer; num_cores = kbdev->gpu_props.num_cores; if (num_cores <= 4) mem_offset = MALI_SIZE_OF_HWCBLK * 3; else mem_offset = MALI_SIZE_OF_HWCBLK * 4; data = &platform->hwc_data.data[0]; if (platform->hwcnt_choose_jm > 0) { data[HWC_DATA_GPU_ACTIVE] = *(acc_addr + 6); data[HWC_DATA_GPU_JS0_ACTIVE] = *(acc_addr + 10); data[HWC_DATA_GPU_JS1_ACTIVE] = *(acc_addr + 18); data[HWC_DATA_GPU_JS2_ACTIVE] = *(acc_addr + 26); } if (platform->hwcnt_choose_tiler > 0) { data[HWC_DATA_TILER_ACTIVE] = *(acc_addr + MALI_SIZE_OF_HWCBLK + 45); } if (platform->hwcnt_choose_shader > 0) { for (i=0; i < num_cores; i++) { if ( i == 3 && (num_cores == 5 || num_cores == 6) ) mem_offset += MALI_SIZE_OF_HWCBLK; data[HWC_DATA_TRIPIPE_ACTIVE] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 26); data[HWC_DATA_ARITH_WORDS]+= *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 27); data[HWC_DATA_LS_ISSUES] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 32); data[HWC_DATA_TEX_ISSUES] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 42); if (platform->hwcnt_choose_shader != 0x560) { data[HWC_DATA_ARITH_CYCLES_REG] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 28); data[HWC_DATA_ARITH_CYCLES_L0] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 29); data[HWC_DATA_ARITH_FRAG_DEPEND] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 30); data[HWC_DATA_LS_WORDS] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 32); data[HWC_DATA_TEX_WORDS] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 38); data[HWC_DATA_FRAG_ACTIVE] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 4); data[HWC_DATA_FRAG_PRIMITIVES] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 5); data[HWC_DATA_COMPUTE_ACTIVE] += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + 22); } } } if (platform->hwcnt_choose_mmu_l2 > 0) { data[HWC_DATA_MMU_HIT] = *(acc_addr + 2*MALI_SIZE_OF_HWCBLK + 4); data[HWC_DATA_NEW_MISS] = *(acc_addr + 2*MALI_SIZE_OF_HWCBLK + 5); data[HWC_DATA_L2_EXT_WR_BEAT] = *(acc_addr + 2*MALI_SIZE_OF_HWCBLK + 30); data[HWC_DATA_L2_EXT_RD_BEAT] = *(acc_addr + 2*MALI_SIZE_OF_HWCBLK + 31); } err = MALI_ERROR_NONE; return err; } #endif mali_error hwcnt_get_utilization_resource(struct kbase_device *kbdev) { int num_cores; int mem_offset; unsigned int *acc_addr; u32 arith_words = 0, ls_issues = 0, tex_issues = 0, tripipe_active = 0, div_tripipe_active; mali_error err = MALI_ERROR_FUNCTION_FAILED; int i; if (kbdev->gpu_props.num_core_groups != 1) { /* num of core groups must be 1 on T76X */ goto out; } acc_addr = (unsigned int*)kbdev->hwcnt.acc_buffer; num_cores = kbdev->gpu_props.num_cores; if (num_cores <= 4) mem_offset = MALI_SIZE_OF_HWCBLK * 3; else mem_offset = MALI_SIZE_OF_HWCBLK * 4; for (i=0; i < num_cores; i++) { if ( i == 3 && (num_cores == 5 || num_cores == 6) ) mem_offset += MALI_SIZE_OF_HWCBLK; tripipe_active += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + OFFSET_TRIPIPE_ACTIVE); arith_words += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + OFFSET_ARITH_WORDS); ls_issues += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + OFFSET_LS_ISSUES); tex_issues += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + OFFSET_TEX_ISSUES); } div_tripipe_active = tripipe_active / 100; if (div_tripipe_active) { kbdev->hwcnt.resources.arith_words = arith_words / div_tripipe_active; kbdev->hwcnt.resources.ls_issues = ls_issues / div_tripipe_active; kbdev->hwcnt.resources.tex_issues = tex_issues / div_tripipe_active; } err = MALI_ERROR_NONE; out: return err; } mali_error hwcnt_get_gpr_resource(struct kbase_device *kbdev, struct kbase_uk_hwcnt_gpr_dump *dump) { int num_cores; int mem_offset; unsigned int* acc_addr; u32 shader_20 = 0, shader_21 = 0; mali_error err = MALI_ERROR_FUNCTION_FAILED; int i; KBASE_DEBUG_ASSERT(kbdev); if (kbdev->gpu_props.num_core_groups != 1) { /* num of core groups must be 1 on T76X */ goto out; } num_cores = kbdev->gpu_props.num_cores; acc_addr = (unsigned int*)kbdev->hwcnt.acc_buffer; if (num_cores <= 4) mem_offset = MALI_SIZE_OF_HWCBLK * 3; else mem_offset = MALI_SIZE_OF_HWCBLK * 4; for (i=0; i < num_cores; i++) { if ( i == 3 && (num_cores == 5 || num_cores == 6) ) mem_offset += MALI_SIZE_OF_HWCBLK; shader_20 += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + OFFSET_SHADER_20); shader_21 += *(acc_addr + mem_offset + MALI_SIZE_OF_HWCBLK * i + OFFSET_SHADER_21); } GPU_LOG(DVFS_INFO, DUMMY, 0u, 0u, "[%d] [%d]\n", shader_20, shader_21); dump->shader_20 = shader_20; dump->shader_21 = shader_21; memset(kbdev->hwcnt.acc_buffer, 0, HWC_ACC_BUFFER_SIZE); err = MALI_ERROR_NONE; out: return err; } void hwcnt_accumulate_resource(struct kbase_device *kbdev) { unsigned int *addr, *acc_addr; int i; KBASE_DEBUG_ASSERT(kbdev); if ((!kbdev->hwcnt.kctx) || (!kbdev->hwcnt.acc_buffer)) return; addr = (unsigned int *)kbdev->hwcnt.kspace_addr; acc_addr = (unsigned int*)kbdev->hwcnt.acc_buffer; /* following copy code will be optimized soon */ for (i=0; i < HWC_ACC_BUFFER_SIZE / 4; i++) { *(acc_addr + i) += *(addr + i); } /* wondering why following buffer clear code is required */ memset(kbdev->hwcnt.kspace_addr, 0, HWC_ACC_BUFFER_SIZE); } mali_error hwcnt_dump(struct kbase_context *kctx) { mali_error err = MALI_ERROR_FUNCTION_FAILED; struct kbase_device *kbdev; if (kctx == NULL) { GPU_LOG(DVFS_ERROR, DUMMY, 0u, 0u, "kctx is NULL error in %s %d \n", __FUNCTION__, err); goto out; } kbdev = kctx->kbdev; if ((!kbdev->hwcnt.kctx) || (!kbdev->hwcnt.is_init) || (!kbdev->hwcnt.is_powered )) { err = MALI_ERROR_NONE; goto out; } err = kbase_instr_hwcnt_dump(kbdev->hwcnt.kctx); if (err != MALI_ERROR_NONE) { // GPU_LOG(DVFS_INFO, DUMMY, 0u, 0u, "kbase_instr_hwcnt_dump error in %s %d \n", __FUNCTION__, err); goto out; } err = kbase_instr_hwcnt_clear(kbdev->hwcnt.kctx); if (err != MALI_ERROR_NONE) { GPU_LOG(DVFS_ERROR, DUMMY, 0u, 0u, "kbase_instr_hwcnt_clear error in %s %d \n", __FUNCTION__, err); goto out; } hwcnt_accumulate_resource(kbdev); err = MALI_ERROR_NONE; out: return err; } void hwcnt_start(struct kbase_device *kbdev) { struct kbase_context *kctx; KBASE_DEBUG_ASSERT(kbdev); kbdev->hwcnt.is_stoped = FALSE; if (kbdev->hwcnt.suspended_kctx) { kctx = kbdev->hwcnt.suspended_kctx; kbdev->hwcnt.suspended_kctx = NULL; } else { kctx = kbdev->hwcnt.kctx; if (kctx == NULL) { GPU_LOG(DVFS_ERROR, DUMMY, 0u, 0u, "hwcnt exception!!!! Both suspended_ktctx and kctx are NULL\n"); BUG(); } } if (kctx) { mali_error err; err = kbase_instr_hwcnt_enable_internal_sec(kbdev, kctx, &kbdev->hwcnt.suspended_state, false); if (err != MALI_ERROR_NONE) { GPU_LOG(DVFS_ERROR, DUMMY, 0u, 0u, "Failed to restore instrumented hardware counters on resume\n"); kbdev->hwcnt.kctx = kctx; } } } void hwcnt_stop(struct kbase_device *kbdev) { struct kbase_context *kctx; KBASE_DEBUG_ASSERT(kbdev); kctx = kbdev->hwcnt.kctx; kbdev->hwcnt.is_stoped = TRUE; if (kctx == NULL) { GPU_LOG(DVFS_ERROR, DUMMY, 0u, 0u, "hwcnt exception!!!! kctx is NULL\n"); return; } kbdev->hwcnt.suspended_kctx = kctx; /* Relevant state was saved into hwcnt.suspended_state when enabling the * counters */ if (kctx) { KBASE_DEBUG_ASSERT(kctx->jctx.sched_info.ctx.flags & KBASE_CTX_FLAG_PRIVILEGED); kbase_instr_hwcnt_disable_sec(kctx); } } void hwcnt_power_up(void *dev) { struct kbase_device *kbdev; kbdev = (struct kbase_device *)dev; if (kbdev->hwcnt.is_init) { int now = ktime_to_ms(ktime_get()); mutex_lock(&kbdev->hwcnt.mlock); kbdev->hwcnt.hwcnt_prev_time = now; if (!kbdev->hwcnt.kctx) hwcnt_start(kbdev); kbdev->hwcnt.is_powered = TRUE; mutex_unlock(&kbdev->hwcnt.mlock); } } void hwcnt_power_down(void *dev) { struct kbase_device *kbdev; mali_error err = MALI_ERROR_FUNCTION_FAILED; kbdev = (struct kbase_device *)dev; if ((kbdev->hwcnt.is_init) && (kbdev->js_data.runpool_irq.secure_mode == MALI_FALSE)) { mutex_lock(&kbdev->hwcnt.mlock); if (kbdev->hwcnt.kctx) err = hwcnt_dump(kbdev->hwcnt.kctx); if (err != MALI_ERROR_NONE) { dev_dbg(kbdev->dev, "hwcnt dump error\n"); } if (kbdev->hwcnt.kctx) hwcnt_stop(kbdev); kbdev->hwcnt.is_powered = FALSE; mutex_unlock(&kbdev->hwcnt.mlock); } } /** * @brief Configure HW counters collection */ mali_error hwcnt_setup(struct kbase_context *kctx, struct kbase_uk_hwcnt_setup *setup) { mali_error err = MALI_ERROR_FUNCTION_FAILED; struct kbase_device *kbdev; struct exynos_context *platform; KBASE_DEBUG_ASSERT(NULL != kctx); kbdev = kctx->kbdev; KBASE_DEBUG_ASSERT(NULL != kbdev); return MALI_ERROR_NONE; if (NULL == setup) { /* Bad parameter - abort */ goto out; } platform = (struct exynos_context *) kbdev->platform_context; if ((!platform->hwcnt_gathering_status) && (!platform->hwcnt_gpr_status)) { err = MALI_ERROR_NONE; goto out; } if ((platform->hwcnt_gpr_status) && (setup->padding == HWC_MODE_GPR_EN)) { if (!kbdev->hwcnt.is_init) { err = MALI_ERROR_NONE; goto out; } mutex_lock(&kbdev->hwcnt.mlock); kbdev->hwcnt.s_enable_for_utilization = kbdev->hwcnt.enable_for_utilization; kbdev->hwcnt.enable_for_utilization = FALSE; kbdev->hwcnt.enable_for_gpr = TRUE; kbdev->hwcnt.kctx_gpr = kctx; platform->hwcnt_bt_clk = 0; KBASE_TRACE_ADD_EXYNOS(kbdev, LSI_HWCNT_ON_GPR, NULL, NULL, 0u, (long unsigned int)kbdev->hwcnt.kspace_addr); err = MALI_ERROR_NONE; mutex_unlock(&kbdev->hwcnt.mlock); goto out; } else if ((platform->hwcnt_gpr_status) && (setup->padding == HWC_MODE_GPR_DIS)) { if (!kbdev->hwcnt.is_init) { err = MALI_ERROR_NONE; goto out; } mutex_lock(&kbdev->hwcnt.mlock); KBASE_TRACE_ADD_EXYNOS(kbdev, LSI_HWCNT_OFF_GPR, NULL, NULL, 0u, (long unsigned int)kbdev->hwcnt.kspace_addr); kbdev->hwcnt.enable_for_gpr = FALSE; kbdev->hwcnt.enable_for_utilization = kbdev->hwcnt.s_enable_for_utilization; kbdev->hwcnt.kctx_gpr = NULL; platform->hwcnt_bt_clk = 0; err = MALI_ERROR_NONE; mutex_unlock(&kbdev->hwcnt.mlock); goto out; } if ((setup->dump_buffer != 0ULL) && (setup->padding == HWC_MODE_UTILIZATION)) { err = kbase_instr_hwcnt_enable_internal_sec(kbdev, kctx, setup, true); mutex_lock(&kbdev->hwcnt.mlock); if (kbdev->hwcnt.kctx) hwcnt_stop(kbdev); kbdev->hwcnt.enable_for_utilization = TRUE; platform->hwcnt_bt_clk = 0; kbdev->hwcnt.cnt_for_stop = 0; kbdev->hwcnt.cnt_for_bt_stop = 0; mutex_unlock(&kbdev->hwcnt.mlock); } out: return err; } void exynos_hwcnt_init(void *dev) { struct kbase_device *kbdev; struct kbase_uk_hwcnt_setup setup_arg; struct kbase_context *kctx; struct kbase_uk_mem_alloc mem; struct kbase_va_region *reg; struct exynos_context *platform; kbdev = (struct kbase_device *)dev; platform = (struct exynos_context *) kbdev->platform_context; if (platform->hwcnt_gathering_status == false) goto out; kctx = kbase_create_context(kbdev, false); if (kctx) { kbdev->hwcnt.kctx = kctx; } else { GPU_LOG(DVFS_INFO, DUMMY, 0u, 0u, "hwcnt error!, hwcnt_init is failed\n"); goto out; } mem.va_pages = mem.commit_pages = mem.extent = 1; mem.flags = BASE_MEM_PROT_GPU_WR | BASE_MEM_PROT_CPU_RD | BASE_MEM_HINT_CPU_RD; reg = kbase_mem_alloc(kctx, mem.va_pages, mem.commit_pages, mem.extent, &mem.flags, &mem.gpu_va, &mem.va_alignment); #if defined(CONFIG_64BIT) kbase_gpu_vm_lock(kctx); if (MALI_ERROR_NONE != kbase_gpu_mmap(kctx, reg, 0, 1, 1)) { kbase_gpu_vm_unlock(kctx); platform->hwcnt_gathering_status = false; GPU_LOG(DVFS_ERROR, DUMMY, 0u, 0u, "exynos_hwcnt_init error!mmap fail\n"); kbase_mem_free(kbdev->hwcnt.kctx, kbdev->hwcnt.suspended_state.dump_buffer); goto out; } kbase_gpu_vm_unlock(kctx); #endif kctx->kbdev->hwcnt.phy_addr = reg->alloc->pages[0]; kctx->kbdev->hwcnt.enable_for_utilization = FALSE; kctx->kbdev->hwcnt.enable_for_gpr = FALSE; kctx->kbdev->hwcnt.suspended_kctx = NULL; kctx->kbdev->hwcnt.timeout = (unsigned int)msecs_to_jiffies(100); kctx->kbdev->hwcnt.is_powered = FALSE; kctx->kbdev->hwcnt.is_stoped = TRUE; mutex_init(&kbdev->hwcnt.mlock); #if defined(CONFIG_64BIT) setup_arg.dump_buffer = reg->start_pfn << PAGE_SHIFT; #else setup_arg.dump_buffer = mem.gpu_va; #endif setup_arg.jm_bm = platform->hwcnt_choose_jm; setup_arg.shader_bm = platform->hwcnt_choose_shader; setup_arg.tiler_bm = platform->hwcnt_choose_tiler; setup_arg.l3_cache_bm = platform->hwcnt_choose_l3_cache; setup_arg.mmu_l2_bm = platform->hwcnt_choose_mmu_l2; setup_arg.padding = HWC_MODE_UTILIZATION; kctx->kbdev->hwcnt.kspace_addr = kbase_kmap_from_physical_address(kbdev); if (MALI_ERROR_NONE != hwcnt_setup(kctx, &setup_arg)) { GPU_LOG(DVFS_ERROR, DUMMY, 0u, 0u, "hwcnt_setup is failed\n"); goto out; } kctx->kbdev->hwcnt.acc_buffer = kmalloc(HWC_ACC_BUFFER_SIZE, GFP_KERNEL); if (kctx->kbdev->hwcnt.acc_buffer) memset(kctx->kbdev->hwcnt.acc_buffer, 0, HWC_ACC_BUFFER_SIZE); else goto out; kbdev->hwcnt.is_init = TRUE; if(kbdev->pm.pm_current_policy->id == KBASE_PM_POLICY_ID_ALWAYS_ON) { mutex_lock(&kbdev->hwcnt.mlock); if (!kbdev->hwcnt.kctx) hwcnt_start(kbdev); mutex_unlock(&kbdev->hwcnt.mlock); } return; out: kbdev->hwcnt.is_init = FALSE; return; } void exynos_hwcnt_remove(void *dev) { struct kbase_device *kbdev; struct exynos_context *platform; kbdev = (struct kbase_device *)dev; if (!kbdev->hwcnt.is_init) return; if (kbdev->hwcnt.kctx && kbdev->hwcnt.suspended_state.dump_buffer) kbase_mem_free(kbdev->hwcnt.kctx, kbdev->hwcnt.suspended_state.dump_buffer); if (kbdev->hwcnt.acc_buffer) kfree(kbdev->hwcnt.acc_buffer); platform = (struct exynos_context *) kbdev->platform_context; kbdev->hwcnt.enable_for_gpr = FALSE; kbdev->hwcnt.enable_for_utilization = FALSE; kbdev->hwcnt.kctx_gpr = NULL; kbdev->hwcnt.kctx = NULL; kbdev->hwcnt.is_stoped = TRUE; kbdev->hwcnt.is_init = FALSE; platform->hwcnt_bt_clk = 0; if (kbdev->hwcnt.kspace_addr) { kbase_kunmap_from_physical_address(kbdev); kbdev->hwcnt.kspace_addr = 0; } mutex_destroy(&kbdev->hwcnt.mlock); } #endif
the_stack_data/107077.c
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that size_t type is defined as described in sys/types.h. */ #include <sys/shm.h> size_t this_type_should_exist;
the_stack_data/140765246.c
#include <stdio.h> int good(void){ printf("%d", 0); printf("%d", 1); printf("%d", 2); return 0; } int main(void){ good(); return 0; }
the_stack_data/99806.c
#include <stdio.h> typedef int ElementType; #define NotFound (-1) /* START: fig2_9.txt */ int BinarySearch (const ElementType A[], ElementType X, int N) { int Low, Mid, High; /* 1*/ Low = 0; High = N - 1; /* 2*/ while (Low <= High) { /* 3*/ Mid = (Low + High) / 2; /* 4*/ if (A[Mid] < X) /* 5*/ Low = Mid + 1; else /* 6*/ if (A[Mid] > X) /* 7*/ High = Mid - 1; else /* 8*/ return Mid; /* Found */ } /* 9*/ return NotFound; /* NotFound is defined as -1 */ } /* END */ main () { static int A[] = { 1, 3, 5, 7, 9, 13, 15 }; const int SizeofA = sizeof (A) / sizeof (A[0]); int i; for (i = 0; i < 20; i++) printf ("BinarySearch of %d returns %d\n", i, BinarySearch (A, i, SizeofA)); return 0; }
the_stack_data/36044.c
/** ****************************************************************************** * @file stm32f0xx_ll_pwr.c * @author MCD Application Team * @brief PWR LL module driver. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ #if defined(USE_FULL_LL_DRIVER) /* Includes ------------------------------------------------------------------*/ #include "stm32f0xx_ll_pwr.h" #include "stm32f0xx_ll_bus.h" /** @addtogroup STM32F0xx_LL_Driver * @{ */ #if defined(PWR) /** @defgroup PWR_LL PWR * @{ */ /* Private types -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private constants ---------------------------------------------------------*/ /* Private macros ------------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Exported functions --------------------------------------------------------*/ /** @addtogroup PWR_LL_Exported_Functions * @{ */ /** @addtogroup PWR_LL_EF_Init * @{ */ /** * @brief De-initialize the PWR registers to their default reset values. * @retval An ErrorStatus enumeration value: * - SUCCESS: PWR registers are de-initialized * - ERROR: not applicable */ ErrorStatus LL_PWR_DeInit(void) { /* Force reset of PWR clock */ LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_PWR); /* Release reset of PWR clock */ LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_PWR); return SUCCESS; } /** * @} */ /** * @} */ /** * @} */ #endif /* defined(PWR) */ /** * @} */ #endif /* USE_FULL_LL_DRIVER */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
the_stack_data/7889.c
#include <stdio.h> main() { FILE *fp; int ch; int filename[20]; int nlines = 0; int nsents = 0; printf("Enter file to test: "); gets(filename); if ((fp = fopen(filename,"r")) == NULL) { printf("Cannot open %s.\n", filename); exit(1); } while ((ch = fgetc(fp)) != EOF) { if (ch == '\n') ++nlines; else if (ch == '.' || ch == '!' || ch == '?') { if ((ch = fgetc(fp)) != '.') ++nsents; else while ((ch=fgetc(fp)) == '.') ; ungetc(ch, fp); } } printf("%d line(s), %d sentence(s).\n", nlines, nsents); }
the_stack_data/97013309.c
#include <stdio.h> struct sss{ int i1:17; int i2:21; int i3:17; }; static union u{ struct sss sss; unsigned char a[sizeof (struct sss)]; } u; int main (void) { int i; for (i = 0; i < sizeof (struct sss); i++) u.a[i] = 0; u.sss.i1 = 131071.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); u.sss.i2 = 2097151.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); u.sss.i3 = 131071.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); return 0; }
the_stack_data/11702.c
#define MYNAME "Ender" int globalVar = 100; #include <stdio.h> int main(int argc, char const *argv[]) { /* code */ char middleInitial; printf("What is yout middle initial? "); scanf(" %c", &middleInitial); printf("You entered: %c \n\n", middleInitial); char firstName[30], lastName[30]; printf("What is your name? "); scanf(" %s %s", firstName, lastName); printf("Hi, %s %c. %s. \n\n", firstName, middleInitial, lastName); int month, day, year; printf("What's your birth date? "); scanf(" %d/%d/%d", &day, &month, &year); printf("\nYour birthdate is: %d/%d/%d\n\n", day, month, year); return 0; }
the_stack_data/242331465.c
#include <stdio.h> #include <string.h> void B(n) { for(int i = 0; i < n; i++) { printf("%d\n", i); } } int main() { int n = 10; B(n); }
the_stack_data/159516367.c
#include <stdio.h> #include <stdlib.h> int length(char* s) { int i = 0; while(s[i]) i++; return i; } short change_sample(unsigned char lower_byte, unsigned char upper_byte, char lower_flag_byte, char upper_flag_byte) { unsigned char changed_lower_byte = lower_byte; changed_lower_byte &= ~1; changed_lower_byte = changed_lower_byte | (49 - lower_flag_byte); unsigned char changed_upper_byte = upper_byte; changed_upper_byte &= ~1; changed_upper_byte = changed_upper_byte | (49 - upper_flag_byte); return (changed_lower_byte << 8) | changed_upper_byte; } void process(FILE* input_file, FILE* output_file, char* flag, int flag_length) { unsigned char t; for (int i = 0; i < 4; i++) { fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); } int chunk_size = 0; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); chunk_size = chunk_size | t; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); chunk_size = (t << 8) | chunk_size; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); chunk_size = (t << 16) | chunk_size; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); chunk_size = (t << 24) | chunk_size; for (int i = 0; i < 8; i++) { fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); } int subchunk_size = 0; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); subchunk_size = subchunk_size | t; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); subchunk_size = subchunk_size | (t << 8); fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); subchunk_size = subchunk_size | (t << 16); fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); subchunk_size = subchunk_size | (t << 24); short audio_format = 0; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); audio_format = audio_format | t; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); audio_format = audio_format | (t << 8); short number_of_channels = 0; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); number_of_channels = number_of_channels | t; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); number_of_channels = number_of_channels | (t << 8); int sample_rate = 0; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); sample_rate = sample_rate | t; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); sample_rate = sample_rate | (t << 8); fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); sample_rate = sample_rate | (t << 16); fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); sample_rate = sample_rate | (t << 24); int byte_rate = 0; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); byte_rate = byte_rate | t; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); byte_rate = byte_rate | (t << 8); fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); byte_rate = byte_rate | (t << 16); fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); byte_rate = byte_rate | (t << 24); short block_align = 0; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); block_align = block_align | t; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); block_align = block_align | (t << 8); short bits_per_sample = 0; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); bits_per_sample = bits_per_sample | t; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); bits_per_sample = bits_per_sample | (t << 8); for (int i = 0; i < 4; i++) { fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); } int data_length = 0; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); data_length = data_length | t; fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); data_length = data_length | (t << 8); fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); data_length = data_length | (t << 16); fread(&t, 1, 1, input_file); fwrite(&t, 1, 1, output_file); data_length = data_length | (t << 24); unsigned char lower_byte; unsigned char upper_byte; for (int i = 0; i < data_length; i += 2) { fread(&lower_byte, 1, 1, input_file); fread(&upper_byte, 1, 1, input_file); unsigned char lower_flag_byte = flag[i % flag_length]; unsigned char upper_flag_byte = flag[(i + 1) % flag_length]; short new_sample = change_sample(lower_byte, upper_byte, lower_flag_byte, upper_flag_byte); lower_byte = new_sample & 0xff; upper_byte = (new_sample >> 8) & 0xff; fwrite(&lower_byte, 1, 1, output_file); fwrite(&upper_byte, 1, 1, output_file); } while(fread(&t, 1, 1, input_file)) { fwrite(&t, 1, 1, output_file); } } int main(int argc, char const *argv[]) { FILE* input = fopen("input", "rb"); FILE* output = fopen("output", "wb"); // donnuCTF{chang1ng_th3_wav3} // 011001000110111101101110011011100111010101000011010101000100011001111011011000110110100001100001011011100110011100110001011011100110011101011111011101000110100000110011010111110111011101100001011101100011001101111101 char flag [217]; printf("Enter the flag >> "); fgets(flag, 217, stdin); process(input, output, flag, length(flag)); fclose(input); fclose(output); }
the_stack_data/97012081.c
#include <stdio.h> int main() { int a, b, c; printf("enter the three numbers you want to comapare:\n"); printf(" enter the first value:"); scanf("%i", &a); printf("enter the second value:\n"); scanf("%i", &b); printf("enter the third value:\n"); scanf("%i", &c); if (a > b && a > c) { printf("the higest number is:%d", a); } if (b > a && b > c) { printf("the highest value is:%d",b); } if (c > a && c > b) { printf("the highest number is:%d", c); } return 0; }
the_stack_data/198580238.c
/* Name: Your Name Roll_Number: Your Roll_Number */ #include <stdio.h> #include <stdlib.h> #include <pthread.h> int sum = 10; void* pThreadFunc(void* arg) { int *limit_ptr = (int*) arg; int limit = *limit_ptr; for (int i = 0; i < limit; i++) { sum -= 1; } printf("Child %d\n",sum ); pthread_exit(0); } int main(int argc, char **argv) { printf("%s\n", "Part 2: Pthread one"); pthread_t tid; int limit = 100; pthread_attr_t attr; pthread_attr_init(&attr); pthread_create(&tid, &attr, pThreadFunc, &limit); for (long long i = 0; i < 90; i++) { sum += 1; } printf("Parent %d\n", sum); pthread_join(tid, NULL); }
the_stack_data/50138855.c
/* This testcase is part of GDB, the GNU debugger. Copyright 2018-2019 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ static int minsym_var; static int minsym_fun (void) { minsym_var++; } int main (void) { return minsym_fun (); }
the_stack_data/182953043.c
/* * * This software is Copyright (c) 2012 Dhiru Kholia <dhiru at openwall.com> * with some code (c) 2012 Lukas Odzioba <[email protected]> * and improvements (c) 2014 by magnum and JimF. * * This is hereby released to the general public under the following terms: * Redistribution and use in source and binary forms, with or without * modification, are permitted. */ #ifdef HAVE_OPENCL #if FMT_EXTERNS_H extern struct fmt_main fmt_opencl_zip; #elif FMT_REGISTERS_H john_register_one(&fmt_opencl_zip); #else #include <string.h> #include <openssl/des.h> #ifdef _OPENMP #include <omp.h> #endif #include "arch.h" #include "formats.h" #include "common.h" #include "misc.h" #include "common-opencl.h" #include "pkzip.h" #include "dyna_salt.h" #include "hmac_sha.h" #include "options.h" #include "stdint.h" #define OPENCL_FORMAT 1 #include "pbkdf2_hmac_sha1.h" #define FORMAT_LABEL "zip-opencl" #define FORMAT_NAME "ZIP" #define ALGORITHM_NAME "PBKDF2-SHA1 OpenCL AES" #define MIN_KEYS_PER_CRYPT 1 #define MAX_KEYS_PER_CRYPT 1 # define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #define BINARY_ALIGN MEM_ALIGN_NONE #define PLAINTEXT_LENGTH 64 #define SALT_SIZE sizeof(my_salt*) #define SALT_ALIGN 4 typedef struct { uint32_t length; uint8_t v[PLAINTEXT_LENGTH]; } zip_password; typedef struct { uint32_t v[(2 * KEY_LENGTH(3) + PWD_VER_LENGTH + 3) / 4]; } zip_hash; typedef struct { uint32_t iterations; uint32_t outlen; uint32_t skip_bytes; uint8_t length; uint8_t salt[64]; } zip_salt; typedef struct my_salt_t { dyna_salt dsalt; uint32_t comp_len; struct { uint16_t type : 4; uint16_t mode : 4; } v; unsigned char passverify[2]; unsigned char salt[SALT_LENGTH(3)]; //uint64_t data_key; // MSB of md5(data blob). We lookup using this. unsigned char datablob[1]; } my_salt; static my_salt *saved_salt; static unsigned char (*crypt_key)[WINZIP_BINARY_SIZE]; static cl_int cl_error; static zip_password *inbuffer; static zip_hash *outbuffer; static zip_salt currentsalt; static cl_mem mem_in, mem_out, mem_setting; static struct fmt_main *self; static size_t insize, outsize, settingsize; #define STEP 0 #define SEED 256 // This file contains auto-tuning routine(s). Has to be included after formats definitions. #include "opencl-autotune.h" #include "memdbg.h" static const char * warn[] = { "xfer: ", ", crypt: ", ", xfer: " }; /* ------- Helper functions ------- */ static size_t get_task_max_work_group_size() { return autotune_get_task_max_work_group_size(FALSE, 0, crypt_kernel); } static void create_clobj(size_t gws, struct fmt_main *self) { insize = sizeof(zip_password) * gws; outsize = sizeof(zip_hash) * gws; settingsize = sizeof(zip_salt); inbuffer = mem_calloc(1, insize); outbuffer = mem_alloc(outsize); crypt_key = mem_calloc(gws, sizeof(*crypt_key)); mem_in = clCreateBuffer(context[gpu_id], CL_MEM_READ_ONLY, insize, NULL, &cl_error); HANDLE_CLERROR(cl_error, "Error allocating mem in"); mem_setting = clCreateBuffer(context[gpu_id], CL_MEM_READ_ONLY, settingsize, NULL, &cl_error); HANDLE_CLERROR(cl_error, "Error allocating mem setting"); mem_out = clCreateBuffer(context[gpu_id], CL_MEM_WRITE_ONLY, outsize, NULL, &cl_error); HANDLE_CLERROR(cl_error, "Error allocating mem out"); HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 0, sizeof(mem_in), &mem_in), "Error while setting mem_in kernel argument"); HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 1, sizeof(mem_out), &mem_out), "Error while setting mem_out kernel argument"); HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 2, sizeof(mem_setting), &mem_setting), "Error while setting mem_salt kernel argument"); } static void release_clobj(void) { if (crypt_key) { HANDLE_CLERROR(clReleaseMemObject(mem_in), "Release mem in"); HANDLE_CLERROR(clReleaseMemObject(mem_setting), "Release mem setting"); HANDLE_CLERROR(clReleaseMemObject(mem_out), "Release mem out"); MEM_FREE(crypt_key); MEM_FREE(inbuffer); MEM_FREE(outbuffer); } } static void done(void) { if (autotuned) { release_clobj(); HANDLE_CLERROR(clReleaseKernel(crypt_kernel), "Release kernel"); HANDLE_CLERROR(clReleaseProgram(program[gpu_id]), "Release Program"); autotuned--; } } static void init(struct fmt_main *_self) { self = _self; opencl_prepare_dev(gpu_id); } static void reset(struct db_main *db) { if (!autotuned) { char build_opts[64]; snprintf(build_opts, sizeof(build_opts), "-DKEYLEN=%d -DSALTLEN=%d -DOUTLEN=%d", PLAINTEXT_LENGTH, (int)sizeof(currentsalt.salt), (int)sizeof(outbuffer->v)); opencl_init("$JOHN/kernels/pbkdf2_hmac_sha1_unsplit_kernel.cl", gpu_id, build_opts); crypt_kernel = clCreateKernel(program[gpu_id], "derive_key", &cl_error); HANDLE_CLERROR(cl_error, "Error creating kernel"); // Initialize openCL tuning (library) for this format. opencl_init_auto_setup(SEED, 0, NULL, warn, 1, self, create_clobj, release_clobj, sizeof(zip_password), 0, db); // Auto tune execution from shared/included code. autotune_run(self, 1, 0, 1000); } } static void *get_salt(char *ciphertext) { int i; my_salt salt, *psalt; static unsigned char *ptr; /* extract data from "ciphertext" */ c8 *copy_mem = strdup(ciphertext); c8 *cp, *p; if (!ptr) ptr = mem_alloc_tiny(sizeof(my_salt*),sizeof(my_salt*)); p = copy_mem + WINZIP_TAG_LENGTH+1; /* skip over "$zip2$*" */ memset(&salt, 0, sizeof(salt)); cp = strtokm(p, "*"); // type salt.v.type = atoi((const char*)cp); cp = strtokm(NULL, "*"); // mode salt.v.mode = atoi((const char*)cp); cp = strtokm(NULL, "*"); // file_magic enum (ignored) cp = strtokm(NULL, "*"); // salt for (i = 0; i < SALT_LENGTH(salt.v.mode); i++) salt.salt[i] = (atoi16[ARCH_INDEX(cp[i<<1])]<<4) | atoi16[ARCH_INDEX(cp[(i<<1)+1])]; cp = strtokm(NULL, "*"); // validator salt.passverify[0] = (atoi16[ARCH_INDEX(cp[0])]<<4) | atoi16[ARCH_INDEX(cp[1])]; salt.passverify[1] = (atoi16[ARCH_INDEX(cp[2])]<<4) | atoi16[ARCH_INDEX(cp[3])]; cp = strtokm(NULL, "*"); // data len sscanf((const char *)cp, "%x", &salt.comp_len); // later we will store the data blob in our own static data structure, and place the 64 bit LSB of the // MD5 of the data blob into a field in the salt. For the first POC I store the entire blob and just // make sure all my test data is small enough to fit. cp = strtokm(NULL, "*"); // data blob // Ok, now create the allocated salt record we are going to return back to John, using the dynamic // sized data buffer. psalt = (my_salt*)mem_calloc(1, sizeof(my_salt) + salt.comp_len); psalt->v.type = salt.v.type; psalt->v.mode = salt.v.mode; psalt->comp_len = salt.comp_len; psalt->dsalt.salt_alloc_needs_free = 1; // we used mem_calloc, so JtR CAN free our pointer when done with them. memcpy(psalt->salt, salt.salt, sizeof(salt.salt)); psalt->passverify[0] = salt.passverify[0]; psalt->passverify[1] = salt.passverify[1]; // set the JtR core linkage stuff for this dyna_salt psalt->dsalt.salt_cmp_offset = SALT_CMP_OFF(my_salt, comp_len); psalt->dsalt.salt_cmp_size = SALT_CMP_SIZE(my_salt, comp_len, datablob, psalt->comp_len); if (strcmp((const char*)cp, "ZFILE")) { for (i = 0; i < psalt->comp_len; i++) psalt->datablob[i] = (atoi16[ARCH_INDEX(cp[i<<1])]<<4) | atoi16[ARCH_INDEX(cp[(i<<1)+1])]; } else { c8 *Fn, *Oh, *Ob; long len; uint32_t id; FILE *fp; Fn = strtokm(NULL, "*"); Oh = strtokm(NULL, "*"); Ob = strtokm(NULL, "*"); fp = fopen((const char*)Fn, "rb"); if (!fp) { psalt->v.type = 1; // this will tell the format to 'skip' this salt, it is garbage goto Bail; } sscanf((const char*)Oh, "%lx", &len); if (fseek(fp, len, SEEK_SET)) { fclose(fp); psalt->v.type = 1; goto Bail; } id = fget32LE(fp); if (id != 0x04034b50U) { fclose(fp); psalt->v.type = 1; goto Bail; } sscanf((const char*)Ob, "%lx", &len); if (fseek(fp, len, SEEK_SET)) { fclose(fp); psalt->v.type = 1; goto Bail; } if (fread(psalt->datablob, 1, psalt->comp_len, fp) != psalt->comp_len) { fclose(fp); psalt->v.type = 1; goto Bail; } fclose(fp); } Bail:; MEM_FREE(copy_mem); memcpy(ptr, &psalt, sizeof(my_salt*)); return (void*)ptr; } static void set_salt(void *salt) { saved_salt = *((my_salt**)salt); memcpy((char*)currentsalt.salt, saved_salt->salt, SALT_LENGTH(saved_salt->v.mode)); currentsalt.length = SALT_LENGTH(saved_salt->v.mode); currentsalt.iterations = KEYING_ITERATIONS; currentsalt.outlen = PWD_VER_LENGTH; currentsalt.skip_bytes = 2 * KEY_LENGTH(saved_salt->v.mode); HANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_setting, CL_FALSE, 0, settingsize, &currentsalt, 0, NULL, NULL), "Copy setting to gpu"); } #undef set_key static void set_key(char *key, int index) { uint8_t length = strlen(key); if (length > PLAINTEXT_LENGTH) length = PLAINTEXT_LENGTH; inbuffer[index].length = length; memcpy(inbuffer[index].v, key, length); } static char *get_key(int index) { static char ret[PLAINTEXT_LENGTH + 1]; uint8_t length = inbuffer[index].length; memcpy(ret, inbuffer[index].v, length); ret[length] = '\0'; return ret; } static int crypt_all(int *pcount, struct db_salt *salt) { const int count = *pcount; int index; size_t *lws = local_work_size ? &local_work_size : NULL; global_work_size = GET_MULTIPLE_OR_BIGGER(count, local_work_size); if (saved_salt->v.type) { // This salt passed valid() but failed get_salt(). // Should never happen. memset(crypt_key, 0, count * WINZIP_BINARY_SIZE); return count; } /// Copy data to gpu BENCH_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_in, CL_FALSE, 0, insize, inbuffer, 0, NULL, multi_profilingEvent[0]), "Copy data to gpu"); /// Run kernel BENCH_CLERROR(clEnqueueNDRangeKernel(queue[gpu_id], crypt_kernel, 1, NULL, &global_work_size, lws, 0, NULL, multi_profilingEvent[1]), "Run kernel"); /// Read the result back BENCH_CLERROR(clEnqueueReadBuffer(queue[gpu_id], mem_out, CL_TRUE, 0, outsize, outbuffer, 0, NULL, multi_profilingEvent[2]), "Copy result back"); if (ocl_autotune_running) return count; #ifdef _OPENMP #pragma omp parallel for #endif for (index = 0; index < count; index++) { if (!memcmp((unsigned char*)outbuffer[index].v, saved_salt->passverify, 2)) { unsigned char pwd_ver[4+64]; pbkdf2_sha1(inbuffer[index].v, inbuffer[index].length, saved_salt->salt, SALT_LENGTH(saved_salt->v.mode), KEYING_ITERATIONS, pwd_ver, KEY_LENGTH(saved_salt->v.mode), KEY_LENGTH(saved_salt->v.mode)); hmac_sha1(pwd_ver, KEY_LENGTH(saved_salt->v.mode), (const unsigned char*)saved_salt->datablob, saved_salt->comp_len, crypt_key[index], WINZIP_BINARY_SIZE); } else memset(crypt_key[index], 0, WINZIP_BINARY_SIZE); } return count; } static int cmp_all(void *binary, int count) { int i; for (i = 0; i < count; i++) if (((ARCH_WORD_32*)&(crypt_key[i]))[0] == ((ARCH_WORD_32*)binary)[0]) return 1; return 0; } static int cmp_one(void *binary, int index) { return (((ARCH_WORD_32*)&(crypt_key[index]))[0] == ((ARCH_WORD_32*)binary)[0]); } static int cmp_exact(char *source, int index) { void *b = winzip_common_binary(source); return !memcmp(b, crypt_key[index], sizeof(crypt_key[index])); } struct fmt_main fmt_opencl_zip = { { FORMAT_LABEL, FORMAT_NAME, ALGORITHM_NAME, WINZIP_BENCHMARK_COMMENT, WINZIP_BENCHMARK_LENGTH, 0, PLAINTEXT_LENGTH, WINZIP_BINARY_SIZE, BINARY_ALIGN, SALT_SIZE, SALT_ALIGN, MIN_KEYS_PER_CRYPT, MAX_KEYS_PER_CRYPT, FMT_CASE | FMT_8_BIT | FMT_OMP | FMT_DYNA_SALT, { NULL }, { WINZIP_FORMAT_TAG }, winzip_common_tests }, { init, done, reset, fmt_default_prepare, winzip_common_valid, winzip_common_split, winzip_common_binary, get_salt, { NULL }, fmt_default_source, { fmt_default_binary_hash /* Not usable with $SOURCE_HASH$ */ }, fmt_default_dyna_salt_hash, NULL, set_salt, set_key, get_key, fmt_default_clear_keys, crypt_all, { fmt_default_get_hash /* Not usable with $SOURCE_HASH$ */ }, cmp_all, cmp_one, cmp_exact } }; #endif /* plugin stanza */ #endif /* HAVE_OPENCL */
the_stack_data/263261.c
#include <stdio.h> #include <string.h> int countOccurrences(char * str, char * search); int main () { char str[100]; char search[100]; int count; printf("Enter thr string : "); gets(str); printf("Enter word to search occurrences : "); gets(search); count = countOccurrences(str, search); printf("Total occurrences of '%s' : %d", search, count); return 0; } int countOccurrences(char * str, char * search) { int i, j, f, count; int sl, searchl; sl = strlen(str); searchl = strlen(search); count = 0; for(i = 0; i <= sl - searchl; i++) { f = 1; for(j = 0; j < searchl; j++) { if(str[i + j] != search[j]) { f = 0; break; } } if(f == 1) { count++; } } return count; }
the_stack_data/37637526.c
#include<stdio.h> #include<stdlib.h> struct LinkedListNode { int data; struct LinkedListNode *next; }; struct LinkedListNode* getNewNode() { // I don't need to cast the malloc in c return malloc(sizeof(struct LinkedListNode)); } struct LinkedListNode* insertAtBeginning(struct LinkedListNode** hashTable, int index, int data) { struct LinkedListNode* newNode = getNewNode(); // the new node newNode->data = data; newNode->next = NULL; // for now I can put the next to be null // check if the block is containing null or not if (hashTable[index] == NULL) { // now just insert the new element at beginning hashTable[index] = newNode; return hashTable[index]; // returning the new address of the block } // if collisions occur struct LinkedListNode* blockListAddress = hashTable[index]; // the address pointing to first node of linked list newNode->next = blockListAddress; // storing the address of block in the next of the new linkedlist hashTable[index] = newNode; // changing the block address to the address of new node (as we have to insert in beginning) return hashTable[index]; } struct LinkedListNode* searchMe(struct LinkedListNode** hashTable, int index, int key) { struct LinkedListNode* res = NULL; struct LinkedListNode* temp = hashTable[index]; if (temp == NULL) return NULL; // if we just have one element in the block then the while loop below won't get executed // because here condition is temp->next which will be null, thus here I have written if condition if (hashTable[index] != NULL && hashTable[index]->data == key) { return hashTable[index]; } // if not null then traverse through linked list while (temp != NULL) { if (key == temp->data) res = temp; temp = temp->next; } return res; } int hashFunction(int num) { return num%10; } int main() { int n; printf("\nEnter elements to be stored\n"); scanf("%d", &n); // declaring the hashTable of size n (i.e. size of input elements), its gonna have pointers to LinkedListNode struct LinkedListNode** hashTable = malloc(10*sizeof(struct LinkedListNode*)); // I have given memory to the table, now I even need to give memory to the elements in the table int i; for (i = 0; i < 10; ++i) { hashTable[i] = NULL; } int d; printf("\nEnter the elements in array\n"); for (i = 0; i < n; ++i) { scanf("%d", &d); int hashedValue = hashFunction(d); hashTable[hashedValue] = insertAtBeginning(hashTable, hashedValue, d); } int key; printf("\nEnter the element you want to search for\n"); scanf("%d", &key); int ind = hashFunction(key); struct LinkedListNode* res = searchMe(hashTable, ind, key); if (res == NULL) { printf("\nNot found\n"); } else { printf("\n%d is found\n", res->data); } } // time complexity in worst case for searching = O(n), // average case t.c = O(1+alpha), where alpha = n/m // n <- number of elements in hashtable // m <- size of hashtable // so alpha is 1 in this case // thus average t.c = theta(1)
the_stack_data/151706638.c
/* Copyright (C) 2003 Free Software Foundation, Inc. */ /* { dg-do compile } */ /* { dg-options -fno-dollars-in-identifiers } */ /* Test that -fno-dollars-in-identifiers is honoured. Neil Booth, 17 May 2003. */ int foobar$; /* { dg-error "11:stray '\\$'" } */
the_stack_data/139201684.c
#include <stdio.h> #include <string.h> main() { char nome[9]; int tot; printf("Digite um nome: "); gets(nome); //strlen tot = strlen(nome); printf("strlen: %i\n", tot); }
the_stack_data/181392173.c
/* Test program for multi-register variable. Copyright 2003-2020 Free Software Foundation, Inc. This file is part of the gdb testsuite. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. This file was written by Michael Elizabeth Chastain ([email protected]). */ struct s_2_by_4 { int field_0; int field_1; }; void marker (struct s_2_by_4 s_whatever) { s_whatever = s_whatever; return; } void foo () { /* I want this variable in a register but I can't really force it */ register struct s_2_by_4 s24; s24.field_0 = 1170; s24.field_1 = 64701; marker (s24); /* break-here */ return; } int main () { foo (); return 0; }
the_stack_data/92328024.c
// Copyright 2021, Kay Hayen, mailto:[email protected] // // Part of "Nuitka", an optimizing Python compiler that is compatible and // integrates with CPython, but also works on its own. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /** For creating classes. * * Currently only the Python3 meta class selection is here, but more will be * added later, should be choose to have our own "__slots__" special metaclass. * **/ // This file is included from another C file, help IDEs to still parse it on // its own. #ifdef __IDE_ONLY__ #include "nuitka/prelude.h" #endif #if PYTHON_VERSION >= 0x300 PyObject *SELECT_METACLASS(PyObject *metaclass, PyObject *bases) { CHECK_OBJECT(metaclass); CHECK_OBJECT(bases); if (likely(PyType_Check(metaclass))) { // Determine the proper metaclass type Py_ssize_t nbases = PyTuple_GET_SIZE(bases); PyTypeObject *winner = (PyTypeObject *)metaclass; #if _DEBUG_CLASSES PRINT_STRING("Bases:"); PRINT_ITEM((PyObject *)bases); PRINT_NEW_LINE(); #endif for (int i = 0; i < nbases; i++) { PyObject *base = PyTuple_GET_ITEM(bases, i); PyTypeObject *base_type = Py_TYPE(base); if (PyType_IsSubtype(winner, base_type)) { // Ignore if current winner is already a subtype. continue; } else if (PyType_IsSubtype(base_type, winner)) { // Use if, if it's a subtype of the current winner. winner = base_type; continue; } else { SET_CURRENT_EXCEPTION_TYPE0_STR(PyExc_TypeError, "metaclass conflict: the metaclass of a derived class must be a " "(non-strict) subclass of the metaclasses of all its bases"); return NULL; } } if (unlikely(winner == NULL)) { return NULL; } #if _DEBUG_CLASSES PRINT_STRING("Metaclass winner:"); PRINT_ITEM((PyObject *)winner); PRINT_NEW_LINE(); #endif Py_INCREF(winner); return (PyObject *)winner; } else { #if _DEBUG_CLASSES PRINT_STRING("Metaclass not a type is used:"); PRINT_ITEM((PyObject *)metaclass); PRINT_NEW_LINE(); #endif Py_INCREF(metaclass); return metaclass; } } #endif
the_stack_data/28261747.c
#include <stdio.h> #include <string.h> /* 合并两个字符串的函数 * str1 : 需要合并的第一个字符串 * str2 : 需要合并的第二个字符串 */ char * combine(char * str1, char * str2) { char str[1024]; char *p = str; strcpy(str, str1); /* 复制第一个字符串 */ strcat(str, str2); /* 将第二个字符串连接到第一个字符串的末尾 */ return p; /* 返回合并好的串的首地址 */ } int main(void) { char *p; p = combine("hello", "world"); /* 调用combine函数 */ printf("%s\n", *p); /* 输出调用结果 */ return 0; }
the_stack_data/200142255.c
#include <stdio.h> int main(void) { printf ("Programming is fun.\n"); return 0; }
the_stack_data/36076107.c
#ifdef __cplusplus # error "A C++ compiler has been selected for C." #endif #if defined(__18CXX) # define ID_VOID_MAIN #endif #if defined(__CLASSIC_C__) /* cv-qualifiers did not exist in K&R C */ # define const # define volatile #endif /* Version number components: V=Version, R=Revision, P=Patch Version date components: YYYY=Year, MM=Month, DD=Day */ #if defined(__INTEL_COMPILER) || defined(__ICC) # define COMPILER_ID "Intel" # if defined(_MSC_VER) # define SIMULATE_ID "MSVC" # endif /* __INTEL_COMPILER = VRP */ # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) # if defined(__INTEL_COMPILER_UPDATE) # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) # else # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) # endif # if defined(__INTEL_COMPILER_BUILD_DATE) /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) # endif # if defined(_MSC_VER) /* _MSC_VER = VVRR */ # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) # endif #elif defined(__PATHCC__) # define COMPILER_ID "PathScale" # define COMPILER_VERSION_MAJOR DEC(__PATHCC__) # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) # if defined(__PATHCC_PATCHLEVEL__) # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) # endif #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) # define COMPILER_ID "Embarcadero" # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) # define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) #elif defined(__BORLANDC__) # define COMPILER_ID "Borland" /* __BORLANDC__ = 0xVRR */ # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) #elif defined(__WATCOMC__) && __WATCOMC__ < 1200 # define COMPILER_ID "Watcom" /* __WATCOMC__ = VVRR */ # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) # if (__WATCOMC__ % 10) > 0 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) # endif #elif defined(__WATCOMC__) # define COMPILER_ID "OpenWatcom" /* __WATCOMC__ = VVRP + 1100 */ # define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) # if (__WATCOMC__ % 10) > 0 # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) # endif #elif defined(__SUNPRO_C) # define COMPILER_ID "SunPro" # if __SUNPRO_C >= 0x5100 /* __SUNPRO_C = 0xVRRP */ # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) # else /* __SUNPRO_CC = 0xVRP */ # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) # define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) # define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) # endif #elif defined(__HP_cc) # define COMPILER_ID "HP" /* __HP_cc = VVRRPP */ # define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) # define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) # define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) #elif defined(__DECC) # define COMPILER_ID "Compaq" /* __DECC_VER = VVRRTPPPP */ # define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) # define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) # define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) #elif defined(__IBMC__) && defined(__COMPILER_VER__) # define COMPILER_ID "zOS" # if defined(__ibmxl__) # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) # else /* __IBMC__ = VRP */ # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) # endif #elif defined(__ibmxl__) || (defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800) # define COMPILER_ID "XL" # if defined(__ibmxl__) # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) # else /* __IBMC__ = VRP */ # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) # endif #elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 # define COMPILER_ID "VisualAge" # if defined(__ibmxl__) # define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) # define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) # define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) # define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) # else /* __IBMC__ = VRP */ # define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) # define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) # define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) # endif #elif defined(__PGI) # define COMPILER_ID "PGI" # define COMPILER_VERSION_MAJOR DEC(__PGIC__) # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) # if defined(__PGIC_PATCHLEVEL__) # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) # endif #elif defined(_CRAYC) # define COMPILER_ID "Cray" # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) #elif defined(__TI_COMPILER_VERSION__) # define COMPILER_ID "TI" /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) #elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) # define COMPILER_ID "Fujitsu" #elif defined(__ghs__) # define COMPILER_ID "GHS" /* __GHS_VERSION_NUMBER = VVVVRP */ # ifdef __GHS_VERSION_NUMBER # define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) # define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) # define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) # endif #elif defined(__TINYC__) # define COMPILER_ID "TinyCC" #elif defined(__BCC__) # define COMPILER_ID "Bruce" #elif defined(__SCO_VERSION__) # define COMPILER_ID "SCO" #elif defined(__ARMCC_VERSION) && !defined(__clang__) # define COMPILER_ID "ARMCC" #if __ARMCC_VERSION >= 1000000 /* __ARMCC_VERSION = VRRPPPP */ # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) #else /* __ARMCC_VERSION = VRPPPP */ # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) #endif #elif defined(__clang__) && defined(__apple_build_version__) # define COMPILER_ID "AppleClang" # if defined(_MSC_VER) # define SIMULATE_ID "MSVC" # endif # define COMPILER_VERSION_MAJOR DEC(__clang_major__) # define COMPILER_VERSION_MINOR DEC(__clang_minor__) # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) # if defined(_MSC_VER) /* _MSC_VER = VVRR */ # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) # endif # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) #elif defined(__clang__) # define COMPILER_ID "Clang" # if defined(_MSC_VER) # define SIMULATE_ID "MSVC" # endif # define COMPILER_VERSION_MAJOR DEC(__clang_major__) # define COMPILER_VERSION_MINOR DEC(__clang_minor__) # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) # if defined(_MSC_VER) /* _MSC_VER = VVRR */ # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) # endif #elif defined(__GNUC__) # define COMPILER_ID "GNU" # define COMPILER_VERSION_MAJOR DEC(__GNUC__) # if defined(__GNUC_MINOR__) # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) # endif # if defined(__GNUC_PATCHLEVEL__) # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) # endif #elif defined(_MSC_VER) # define COMPILER_ID "MSVC" /* _MSC_VER = VVRR */ # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) # if defined(_MSC_FULL_VER) # if _MSC_VER >= 1400 /* _MSC_FULL_VER = VVRRPPPPP */ # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) # else /* _MSC_FULL_VER = VVRRPPPP */ # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) # endif # endif # if defined(_MSC_BUILD) # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) # endif #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) # define COMPILER_ID "ADSP" #if defined(__VISUALDSPVERSION__) /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) #endif #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) # define COMPILER_ID "IAR" # if defined(__VER__) && defined(__ICCARM__) # define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) # define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) # define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) # elif defined(__VER__) && defined(__ICCAVR__) # define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) # define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) # define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) # define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) # endif #elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) # define COMPILER_ID "SDCC" # if defined(__SDCC_VERSION_MAJOR) # define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) # define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) # define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) # else /* SDCC = VRP */ # define COMPILER_VERSION_MAJOR DEC(SDCC/100) # define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) # define COMPILER_VERSION_PATCH DEC(SDCC % 10) # endif #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) # define COMPILER_ID "MIPSpro" # if defined(_SGI_COMPILER_VERSION) /* _SGI_COMPILER_VERSION = VRP */ # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) # else /* _COMPILER_VERSION = VRP */ # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) # endif /* These compilers are either not known or too old to define an identification macro. Try to identify the platform and guess that it is the native compiler. */ #elif defined(__hpux) || defined(__hpua) # define COMPILER_ID "HP" #else /* unknown compiler */ # define COMPILER_ID "" #endif /* Construct the string literal in pieces to prevent the source from getting matched. Store it in a pointer rather than an array because some compilers will just produce instructions to fill the array rather than assigning a pointer to a static array. */ char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; #ifdef SIMULATE_ID char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; #endif #ifdef __QNXNTO__ char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif #if defined(__CRAYXE) || defined(__CRAYXC) char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif #define STRINGIFY_HELPER(X) #X #define STRINGIFY(X) STRINGIFY_HELPER(X) /* Identify known platforms by name. */ #if defined(__linux) || defined(__linux__) || defined(linux) # define PLATFORM_ID "Linux" #elif defined(__CYGWIN__) # define PLATFORM_ID "Cygwin" #elif defined(__MINGW32__) # define PLATFORM_ID "MinGW" #elif defined(__APPLE__) # define PLATFORM_ID "Darwin" #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) # define PLATFORM_ID "Windows" #elif defined(__FreeBSD__) || defined(__FreeBSD) # define PLATFORM_ID "FreeBSD" #elif defined(__NetBSD__) || defined(__NetBSD) # define PLATFORM_ID "NetBSD" #elif defined(__OpenBSD__) || defined(__OPENBSD) # define PLATFORM_ID "OpenBSD" #elif defined(__sun) || defined(sun) # define PLATFORM_ID "SunOS" #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) # define PLATFORM_ID "AIX" #elif defined(__hpux) || defined(__hpux__) # define PLATFORM_ID "HP-UX" #elif defined(__HAIKU__) # define PLATFORM_ID "Haiku" #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) # define PLATFORM_ID "BeOS" #elif defined(__QNX__) || defined(__QNXNTO__) # define PLATFORM_ID "QNX" #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) # define PLATFORM_ID "Tru64" #elif defined(__riscos) || defined(__riscos__) # define PLATFORM_ID "RISCos" #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) # define PLATFORM_ID "SINIX" #elif defined(__UNIX_SV__) # define PLATFORM_ID "UNIX_SV" #elif defined(__bsdos__) # define PLATFORM_ID "BSDOS" #elif defined(_MPRAS) || defined(MPRAS) # define PLATFORM_ID "MP-RAS" #elif defined(__osf) || defined(__osf__) # define PLATFORM_ID "OSF1" #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) # define PLATFORM_ID "SCO_SV" #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) # define PLATFORM_ID "ULTRIX" #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) # define PLATFORM_ID "Xenix" #elif defined(__WATCOMC__) # if defined(__LINUX__) # define PLATFORM_ID "Linux" # elif defined(__DOS__) # define PLATFORM_ID "DOS" # elif defined(__OS2__) # define PLATFORM_ID "OS2" # elif defined(__WINDOWS__) # define PLATFORM_ID "Windows3x" # else /* unknown platform */ # define PLATFORM_ID # endif #elif defined(__INTEGRITY) # if defined(INT_178B) # define PLATFORM_ID "Integrity178" # else /* regular Integrity */ # define PLATFORM_ID "Integrity" # endif #else /* unknown platform */ # define PLATFORM_ID #endif /* For windows compilers MSVC and Intel we can determine the architecture of the compiler being used. This is because the compilers do not have flags that can change the architecture, but rather depend on which compiler is being used */ #if defined(_WIN32) && defined(_MSC_VER) # if defined(_M_IA64) # define ARCHITECTURE_ID "IA64" # elif defined(_M_X64) || defined(_M_AMD64) # define ARCHITECTURE_ID "x64" # elif defined(_M_IX86) # define ARCHITECTURE_ID "X86" # elif defined(_M_ARM64) # define ARCHITECTURE_ID "ARM64" # elif defined(_M_ARM) # if _M_ARM == 4 # define ARCHITECTURE_ID "ARMV4I" # elif _M_ARM == 5 # define ARCHITECTURE_ID "ARMV5I" # else # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) # endif # elif defined(_M_MIPS) # define ARCHITECTURE_ID "MIPS" # elif defined(_M_SH) # define ARCHITECTURE_ID "SHx" # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif #elif defined(__WATCOMC__) # if defined(_M_I86) # define ARCHITECTURE_ID "I86" # elif defined(_M_IX86) # define ARCHITECTURE_ID "X86" # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif #elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) # if defined(__ICCARM__) # define ARCHITECTURE_ID "ARM" # elif defined(__ICCAVR__) # define ARCHITECTURE_ID "AVR" # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif #elif defined(__ghs__) # if defined(__PPC64__) # define ARCHITECTURE_ID "PPC64" # elif defined(__ppc__) # define ARCHITECTURE_ID "PPC" # elif defined(__ARM__) # define ARCHITECTURE_ID "ARM" # elif defined(__x86_64__) # define ARCHITECTURE_ID "x64" # elif defined(__i386__) # define ARCHITECTURE_ID "X86" # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif #else # define ARCHITECTURE_ID #endif /* Convert integer to decimal digit literals. */ #define DEC(n) \ ('0' + (((n) / 10000000)%10)), \ ('0' + (((n) / 1000000)%10)), \ ('0' + (((n) / 100000)%10)), \ ('0' + (((n) / 10000)%10)), \ ('0' + (((n) / 1000)%10)), \ ('0' + (((n) / 100)%10)), \ ('0' + (((n) / 10)%10)), \ ('0' + ((n) % 10)) /* Convert integer to hex digit literals. */ #define HEX(n) \ ('0' + ((n)>>28 & 0xF)), \ ('0' + ((n)>>24 & 0xF)), \ ('0' + ((n)>>20 & 0xF)), \ ('0' + ((n)>>16 & 0xF)), \ ('0' + ((n)>>12 & 0xF)), \ ('0' + ((n)>>8 & 0xF)), \ ('0' + ((n)>>4 & 0xF)), \ ('0' + ((n) & 0xF)) /* Construct a string literal encoding the version number components. */ #ifdef COMPILER_VERSION_MAJOR char const info_version[] = { 'I', 'N', 'F', 'O', ':', 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', COMPILER_VERSION_MAJOR, # ifdef COMPILER_VERSION_MINOR '.', COMPILER_VERSION_MINOR, # ifdef COMPILER_VERSION_PATCH '.', COMPILER_VERSION_PATCH, # ifdef COMPILER_VERSION_TWEAK '.', COMPILER_VERSION_TWEAK, # endif # endif # endif ']','\0'}; #endif /* Construct a string literal encoding the internal version number. */ #ifdef COMPILER_VERSION_INTERNAL char const info_version_internal[] = { 'I', 'N', 'F', 'O', ':', 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', 'i','n','t','e','r','n','a','l','[', COMPILER_VERSION_INTERNAL,']','\0'}; #endif /* Construct a string literal encoding the version number components. */ #ifdef SIMULATE_VERSION_MAJOR char const info_simulate_version[] = { 'I', 'N', 'F', 'O', ':', 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', SIMULATE_VERSION_MAJOR, # ifdef SIMULATE_VERSION_MINOR '.', SIMULATE_VERSION_MINOR, # ifdef SIMULATE_VERSION_PATCH '.', SIMULATE_VERSION_PATCH, # ifdef SIMULATE_VERSION_TWEAK '.', SIMULATE_VERSION_TWEAK, # endif # endif # endif ']','\0'}; #endif /* Construct the string literal in pieces to prevent the source from getting matched. Store it in a pointer rather than an array because some compilers will just produce instructions to fill the array rather than assigning a pointer to a static array. */ char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; #if !defined(__STDC__) # if (defined(_MSC_VER) && !defined(__clang__)) \ || (defined(__ibmxl__) || defined(__IBMC__)) # define C_DIALECT "90" # else # define C_DIALECT # endif #elif __STDC_VERSION__ >= 201000L # define C_DIALECT "11" #elif __STDC_VERSION__ >= 199901L # define C_DIALECT "99" #else # define C_DIALECT "90" #endif const char* info_language_dialect_default = "INFO" ":" "dialect_default[" C_DIALECT "]"; /*--------------------------------------------------------------------------*/ #ifdef ID_VOID_MAIN void main() {} #else # if defined(__CLASSIC_C__) int main(argc, argv) int argc; char *argv[]; # else int main(int argc, char* argv[]) # endif { int require = 0; require += info_compiler[argc]; require += info_platform[argc]; require += info_arch[argc]; #ifdef COMPILER_VERSION_MAJOR require += info_version[argc]; #endif #ifdef COMPILER_VERSION_INTERNAL require += info_version_internal[argc]; #endif #ifdef SIMULATE_ID require += info_simulate[argc]; #endif #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif #if defined(__CRAYXE) || defined(__CRAYXC) require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; (void)argv; return require; } #endif