Windows and AVR build fixes
diff --git a/generator/protoc.bat b/generator/protoc.bat
new file mode 100644
index 0000000..2538c94
--- /dev/null
+++ b/generator/protoc.bat
@@ -0,0 +1,9 @@
+@echo off
+:: This file acts as a drop-in replacement of binary protoc.exe.
+:: It will use either Python-based protoc from grpcio-tools package,
+:: or if it is not available, protoc.exe from path if found.
+
+setLocal enableDelayedExpansion
+set mydir=%~dp0
+python "%mydir%\protoc" %*
+exit /b %ERRORLEVEL%
diff --git a/pb.h b/pb.h
index 9ef8019..32046a2 100644
--- a/pb.h
+++ b/pb.h
@@ -30,9 +30,13 @@
/* Disable support for custom streams (support only memory buffers). */
/* #define PB_BUFFER_ONLY 1 */
+/* Disable support for 64-bit datatypes, for compilers without int64_t
+ or to save some code space. */
+/* #define PB_WITHOUT_64BIT 1 */
+
/* Switch back to the old-style callback function signature.
* This was the default until nanopb-0.2.1. */
-/* #define PB_OLD_CALLBACK_STYLE */
+/* #define PB_OLD_CALLBACK_STYLE 1 */
/* Set the fieldinfo width for all messages using automatic width
* selection. Valid values are 2, 4 and 8. Usually even if you need
@@ -162,6 +166,13 @@
#error You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64).
#endif
+#ifdef PB_WITHOUT_64BIT
+#ifdef PB_CONVERT_DOUBLE_FLOAT
+/* Cannot use doubles without 64-bit types */
+#undef PB_CONVERT_DOUBLE_FLOAT
+#endif
+#endif
+
/* List of possible field types. These are used in the autogenerated code.
* Least-significant 4 bits tell the scalar type
* Most-significant 4 bits specify repeated/required/packed etc.
diff --git a/tests/regression/issue_253/short_array.c b/tests/regression/issue_253/short_array.c
index 5ed6c3f..004e02f 100644
--- a/tests/regression/issue_253/short_array.c
+++ b/tests/regression/issue_253/short_array.c
@@ -13,7 +13,7 @@
TestMessage msg = TestMessage_init_zero;
msg.rep_uint32_count = 1;
- msg.rep_uint32[0] = (1 << 31);
+ msg.rep_uint32[0] = ((uint32_t)1 << 31);
TEST(pb_encode(&ostream, TestMessage_fields, &msg));
TEST(ostream.bytes_written == TestMessage_size);
diff --git a/tests/site_scons/site_tools/nanopb.py b/tests/site_scons/site_tools/nanopb.py
index f0626c6..1014827 100644
--- a/tests/site_scons/site_tools/nanopb.py
+++ b/tests/site_scons/site_tools/nanopb.py
@@ -33,6 +33,7 @@
import SCons.Util
from SCons.Script import Dir, File
import os.path
+import platform
class NanopbWarning(SCons.Warnings.Warning):
pass
@@ -67,7 +68,10 @@
p = os.path.join(n, 'generator', 'protoc')
if os.path.exists(p):
# Use the grcpio-tools protoc wrapper
- return env['ESCAPE'](p)
+ if env['PLATFORM'] == 'win32':
+ return env['ESCAPE'](p + '.bat')
+ else:
+ return env['ESCAPE'](p)
p = env.WhereIs('protoc')
if p: