Skip to content

Commit

Permalink
support classic enum syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
5at committed Aug 24, 2015
1 parent e405f9c commit ed05176
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/addon.cpp
Expand Up @@ -115,13 +115,13 @@ class SHA3Hash: public ObjectWrap {
Final(&state2, digest);

Local<Value> outString;
enum Nan::Encoding enc = static_cast<Nan::Encoding>(ParseEncoding(Isolate::GetCurrent(), info[0], node::encoding::BINARY));
if (enc == Nan::Encoding::HEX) {
enum Nan::Encoding enc = static_cast<Nan::Encoding>(ParseEncoding(Isolate::GetCurrent(), info[0], node::BINARY));
if (enc == Nan::HEX) {
// Hex encoding
char hexdigest[MAX_DIGEST_SIZE * 2];
toHex((const char *) digest, obj->bitlen / 8, hexdigest);
outString = Nan::Encode(hexdigest, obj->bitlen / 4, Nan::Encoding::BINARY);
} else if (enc == Nan::Encoding::BINARY /* || enc == BUFFER */) {
outString = Nan::Encode(hexdigest, obj->bitlen / 4, Nan::BINARY);
} else if (enc == Nan::BINARY /* || enc == BUFFER */) {
outString = Nan::Encode(digest, obj->bitlen / 8, enc);
} else {
return Nan::ThrowError("Unsupported output encoding");
Expand Down

0 comments on commit ed05176

Please sign in to comment.