mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
[fastmanifest] fix unhexlify
Summary: Strictly speaking, it doesn't care if it's the length is SHA1_BYTES * 2. It just has to be even. Also, size_t comes from stddef.h. Test Plan: make local Reviewers: durham, lcharignon Subscribers: mitrandir, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D3626828
This commit is contained in:
parent
c0e7082b92
commit
a7555791cd
@ -8,10 +8,9 @@
|
||||
#define __FASTMANIFEST_CONVERT_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "node.h"
|
||||
|
||||
static int8_t hextable[256] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
@ -40,7 +39,7 @@ static char chartable[16] = {
|
||||
* Turn a hex-encoded string into binary. Returns false on failure.
|
||||
*/
|
||||
static inline bool unhexlify(const char *input, int len, uint8_t *dst) {
|
||||
if (len != SHA1_BYTES * 2) {
|
||||
if (len % 2 != 0) {
|
||||
// wtf.
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user