~ubuntu-branches/ubuntu/utopic/lebiniou/utopic

« back to all changes in this revision

Viewing changes to src/shuffler.c

  • Committer: Package Import Robot
  • Author(s): Logan Rosen
  • Date: 2013-11-13 21:19:20 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20131113211920-af65h37psw9fz6oy
Tags: 3.19.1-1ubuntu1
* Merge from Debian unstable. Remaining changes:
  - debian/patches/fix_ftbfs_with_binutils_gold: Add -lz to fix FTBFS with
    binutils-gold.
* debian/patches/fix_ftbfs_with_binutils_gold: Remove -lavutil, as it is
  already linked.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright 1994-2012 Olivier Girondel
 
2
 *  Copyright 1994-2013 Olivier Girondel
3
3
 *
4
4
 *  This file is part of lebiniou.
5
5
 *
76
76
  if (!libbiniou_verbose)
77
77
    return;
78
78
 
79
 
  printf("[S] Shuffler(%d): Available= [", s->size);
 
79
  VERBOSE(printf("[S] Shuffler(%d): Available= [", s->size));
80
80
  for (c = 0; c < s->size; c++) {
81
81
    if (!s->used[c] && !s->disabled[c]) {
82
 
      if (one)
83
 
        printf(", ");
84
 
      printf("%d", c);
 
82
      if (one) {
 
83
        VERBOSE(printf(", "));
 
84
      }
 
85
      VERBOSE(printf("%d", c));
85
86
      one = 1;
86
87
    }
87
88
  }
88
 
  printf("]\n");
 
89
  VERBOSE(printf("]\n"));
89
90
 
90
91
  one = 0;
91
 
  printf("[S] Shuffler: Disabled= [");
 
92
  VERBOSE(printf("[S] Shuffler: Disabled= ["));
92
93
  for (c = 0; c < s->size; c++) {
93
94
    if (s->disabled[c]) {
94
 
      if (one)
95
 
        printf(", ");
96
 
      printf("%d", c);
 
95
      if (one) {
 
96
        VERBOSE(printf(", "));
 
97
      }
 
98
      VERBOSE(printf("%d", c));
97
99
      one = 1;
98
100
    }
99
101
  }
100
 
  printf("]\n");
 
102
  VERBOSE(printf("]\n"));
101
103
}
102
104
 
103
105
 
158
160
  for (c = 0; (c < s->size) && (s->used[c] || s->disabled[c]); c++);
159
161
 
160
162
  if (c == s->size) {
161
 
    if (s->verbose)
162
 
      printf("[S] Shuffler_clean(%p)\n", s);
 
163
    if (s->verbose) {
 
164
      VERBOSE(printf("[S] Shuffler_clean(%p)\n", s));
 
165
    }
163
166
    memset((void *)s->used, 0, s->size*sizeof(char));
164
167
  }
165
168
}
178
181
 
179
182
  switch (s->mode) {
180
183
  case BS_NONE:
181
 
    printf("[!] WARNING tried to get a value from a shuffler in BS_NONE mode\n");
 
184
    VERBOSE(printf("[!] WARNING tried to get a value from a shuffler in BS_NONE mode\n"));
182
185
    new = 0;
183
186
    break;
184
187
 
200
203
  }
201
204
 
202
205
  if (s->verbose) {
203
 
    printf("[S] Shuffler_get(%p): %d\n", s, new);
 
206
    VERBOSE(printf("[S] Shuffler_get(%p): %d\n", s, new));
204
207
    Shuffler_display(s);
205
208
  }
206
209
  Shuffler_clean(s);
225
228
 
226
229
  s->mode = (enum ShufflerMode)((s->mode+1) & 2);
227
230
  /* TODO human printable shuffler mode (None, Shuffle, ...) */
228
 
  printf("[S] Shuffler mode set to: %d\n", (int)s->mode);
 
231
  VERBOSE(printf("[S] Shuffler mode set to: %d\n", (int)s->mode));
229
232
}
230
233
 
231
234