Changeset 3733 for proto/s2k/trunk


Ignore:
Timestamp:
Mar 18, 2014, 1:47:46 AM (6 years ago)
Author:
ksherdy
Message:

Minor updates.

Location:
proto/s2k/trunk/demo/needle
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/s2k/trunk/demo/needle/needle_template.cpp

    r3676 r3733  
    6868#include <simd-lib/s2p.hpp>
    6969
    70 // Fixed search string.
     70// Fixed pattern.
    7171const char * fixed_pattern  = "needle";
    7272const int pattern_size      = strlen(fixed_pattern);
     
    169169int main(int argc, char * argv[]) {
    170170  if ((2 > argc) || (2 < argc)) {
    171       printf("Usage: %s <filename>\n", argv[0]); exit(-1);   
     171      printf("Usage: %s <filename>\n", argv[0]); exit(1);   
    172172  } 
    173173 
     
    175175  FILE * istream;
    176176  if((istream = fopen(infilename, "rb")) == NULL ) {
    177       printf("fopen error"); exit( 1 );
     177      printf("fopen error\n"); exit(1);
    178178  }
    179179
  • proto/s2k/trunk/demo/needle/needle_template_with_debug.cpp

    r3609 r3733  
    99#include <stdio.h>
    1010#include <stdlib.h>
     11
     12// Fixed pattern
     13const char * fixed_pattern                      = "needle";
     14const   int fixed_pattern_size          = strlen(fixed_pattern);
    1115
    1216/* An example program to return all 'needle' matches, i.e. even overlapping matches. */
     
    8892    printf ("Incorrect number of arguments.\n");
    8993    printf("Usage: %s <filename>\n", argv[0]);
    90     exit(-1);
     94    exit(1);
    9195  } 
    9296   
    9397  infilename = argv[argc-1]; 
    94   if((istream = fopen(infilename, "rb")) == NULL ) { printf("fopen error"); exit( 1 ); }
     98  if((istream = fopen(infilename, "rb")) == NULL ) { printf("fopen error\n"); exit(1); }
    9599
    96100  BytePack * Byte; 
     
    119123  int stream_pos         = 0;
    120124  int match_index                       = 0;
    121 
    122   const char * fixed_pattern    = "needle";
    123         int fixed_pattern_size                  = strlen(fixed_pattern);
    124125
    125126  /* block input */
Note: See TracChangeset for help on using the changeset viewer.