Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(939)

Unified Diff: cmd/bltest/tests/aes_gcm/hex.c

Issue 201830043: Bug 1118245 - Apply uniform style across NSS
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cmd/bltest/blapitest.c ('k') | cmd/btoa/btoa.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cmd/bltest/tests/aes_gcm/hex.c
===================================================================
--- a/cmd/bltest/tests/aes_gcm/hex.c
+++ b/cmd/bltest/tests/aes_gcm/hex.c
@@ -1,68 +1,64 @@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
-int tohex(int c)
-{
- if ((c >= '0') && (c <= '9')) {
- return c - '0';
- }
- if ((c >= 'a') && (c <= 'f')) {
- return c - 'a' + 10;
- }
- if ((c >= 'A') && (c <= 'F')) {
- return c - 'A' + 10;
- }
- return 0;
+int tohex(int c) {
+ if ((c >= '0') && (c <= '9')) {
+ return c - '0';
+ }
+ if ((c >= 'a') && (c <= 'f')) {
+ return c - 'a' + 10;
+ }
+ if ((c >= 'A') && (c <= 'F')) {
+ return c - 'A' + 10;
+ }
+ return 0;
}
-int isspace(int c)
-{
- if (c <= ' ') return 1;
- if (c == '\n') return 1;
- if (c == '\t') return 1;
- if (c == ':') return 1;
- if (c == ';') return 1;
- if (c == ',') return 1;
- return 0;
+int isspace(int c) {
+ if (c <= ' ') return 1;
+ if (c == '\n') return 1;
+ if (c == '\t') return 1;
+ if (c == ':') return 1;
+ if (c == ';') return 1;
+ if (c == ',') return 1;
+ return 0;
}
-void verify_nibble(int nibble, int current)
-{
- if (nibble != 0) {
- fprintf(stderr,"count mismatch %d (nibbles=0x%x)\n",nibble,current);
- fflush(stderr);
- }
+void verify_nibble(int nibble, int current) {
+ if (nibble != 0) {
+ fprintf(stderr, "count mismatch %d (nibbles=0x%x)\n", nibble, current);
+ fflush(stderr);
+ }
}
-int main(int argc, char **argv)
-{
- int c;
- int current = 0;
- int nibble = 0;
- int skip = 0;
+int main(int argc, char **argv) {
+ int c;
+ int current = 0;
+ int nibble = 0;
+ int skip = 0;
- if (argv[1]) {
- skip = atoi(argv[1]);
- }
+ if (argv[1]) {
+ skip = atoi(argv[1]);
+ }
#define NIBBLE_COUNT 2
- while ((c=getchar()) != EOF) {
- if (isspace(c)) {
- verify_nibble(nibble,current);
- continue;
- }
- if (skip) {
- skip--;
- continue;
- }
- current = current << 4 | tohex(c);
- nibble++;
- if (nibble == NIBBLE_COUNT) {
- putchar(current);
- nibble = 0;
- current = 0;
- }
- }
- return 0;
+ while ((c = getchar()) != EOF) {
+ if (isspace(c)) {
+ verify_nibble(nibble, current);
+ continue;
+ }
+ if (skip) {
+ skip--;
+ continue;
+ }
+ current = current << 4 | tohex(c);
+ nibble++;
+ if (nibble == NIBBLE_COUNT) {
+ putchar(current);
+ nibble = 0;
+ current = 0;
+ }
+ }
+ return 0;
}
« no previous file with comments | « cmd/bltest/blapitest.c ('k') | cmd/btoa/btoa.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b