Fix FBString with MSVC
[folly.git] / folly / Varint.h
index 859535736e764351cf32469473fb9a30bf010781..4664cb95d4f5c4e2aa33efdb95f3398199ff1b53 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -87,8 +87,8 @@ inline size_t encodeVarint(uint64_t val, uint8_t* buf) {
     *p++ = 0x80 | (val & 0x7f);
     val >>= 7;
   }
-  *p++ = val;
-  return p - buf;
+  *p++ = uint8_t(val);
+  return size_t(p - buf);
 }
 
 template <class T>