Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overriding of print to be compatible to stdlib again #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Sha/sha1.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <string.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include "sha1.h"

#define SHA1_K0 0x5a827999
Expand Down Expand Up @@ -72,9 +70,10 @@ void Sha1Class::addUncounted(uint8_t data) {
}
}

void Sha1Class::write(uint8_t data) {
size_t Sha1Class::write(uint8_t data) {
++byteCount;
addUncounted(data);
return 1;
}

void Sha1Class::pad() {
Expand Down
2 changes: 1 addition & 1 deletion Sha/sha1.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Sha1Class : public Print
void initHmac(const uint8_t* secret, int secretLength);
uint8_t* result(void);
uint8_t* resultHmac(void);
virtual void write(uint8_t);
virtual size_t write(uint8_t);
using Print::write;
private:
void pad();
Expand Down
5 changes: 2 additions & 3 deletions Sha/sha256.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <string.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include "sha256.h"

uint32_t sha256K[] PROGMEM = {
Expand Down Expand Up @@ -87,9 +85,10 @@ void Sha256Class::addUncounted(uint8_t data) {
}
}

void Sha256Class::write(uint8_t data) {
size_t Sha256Class::write(uint8_t data) {
++byteCount;
addUncounted(data);
return 1;
}

void Sha256Class::pad() {
Expand Down
2 changes: 1 addition & 1 deletion Sha/sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Sha256Class : public Print
void initHmac(const uint8_t* secret, int secretLength);
uint8_t* result(void);
uint8_t* resultHmac(void);
virtual void write(uint8_t);
size_t void write(uint8_t);
using Print::write;
private:
void pad();
Expand Down