Author: sbanacho
Date: Fri Jan 22 22:41:02 2010
New Revision: 902299
URL: http://svn.apache.org/viewvc?rev=902299&view=rev
Log:
AVRO-47. Use void* for byte sequences.
Modified:
hadoop/avro/trunk/CHANGES.txt
hadoop/avro/trunk/lang/c++/api/InputStreamer.hh
hadoop/avro/trunk/lang/c++/api/OutputStreamer.hh
hadoop/avro/trunk/lang/c++/api/Serializer.hh
hadoop/avro/trunk/lang/c++/api/ValidatingWriter.hh
hadoop/avro/trunk/lang/c++/api/Writer.hh
hadoop/avro/trunk/lang/c++/impl/ValidatingWriter.cc
Modified: hadoop/avro/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=902299&r1=902298&r2=902299&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Fri Jan 22 22:41:02 2010
@@ -223,7 +223,7 @@
AVRO-314. Add mvn-install ant task to publish jar to local Maven
repository. (Aaron Kimball via cutting)
- AVRO-243. Use automake generated Makefile.in (sbanacho)
+ AVRO-243. Use automake generated Makefile.in. (sbanacho)
AVRO-198. Fix specification of protocol name, also clarify which
properties are required. (cutting)
@@ -353,6 +353,8 @@
AVRO-313. Default values for fields or records and array (or map) don't
work with ResolvingDecoder (thiru)
+ AVRO-47. Use void* for byte sequences. (sbanacho)
+
AVRO-337. ant test-java fails in Cygwin due to CRLF v LF problem (thiru)
AVRO-347. Add the --unsafe flag to asciidoc in order to include
source/header files (massie)
Modified: hadoop/avro/trunk/lang/c++/api/InputStreamer.hh
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/InputStreamer.hh?rev=902299&r1=902298&r2=902299&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/InputStreamer.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/InputStreamer.hh Fri Jan 22 22:41:02 2010
@@ -43,7 +43,7 @@
virtual size_t readByte(uint8_t &byte) = 0;
virtual size_t readWord(uint32_t &word) = 0;
virtual size_t readLongWord(uint64_t &word) = 0;
- virtual size_t readBytes(uint8_t *bytes, size_t size) = 0;
+ virtual size_t readBytes(void *bytes, size_t size) = 0;
};
@@ -79,7 +79,7 @@
return is_.gcount();
}
- size_t readBytes(uint8_t *bytes, size_t size) {
+ size_t readBytes(void *bytes, size_t size) {
is_.read(reinterpret_cast<char *>(bytes), size);
return is_.gcount();
}
Modified: hadoop/avro/trunk/lang/c++/api/OutputStreamer.hh
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/OutputStreamer.hh?rev=902299&r1=902298&r2=902299&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/OutputStreamer.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/OutputStreamer.hh Fri Jan 22 22:41:02 2010
@@ -44,7 +44,7 @@
virtual size_t writeByte(uint8_t byte) = 0;
virtual size_t writeWord(uint32_t word) = 0;
virtual size_t writeLongWord(uint64_t word) = 0;
- virtual size_t writeBytes(const uint8_t *bytes, size_t size) = 0;
+ virtual size_t writeBytes(const void *bytes, size_t size) = 0;
};
@@ -61,18 +61,19 @@
}
size_t writeWord(uint32_t word) {
- ScreenStreamer::writeBytes(reinterpret_cast<uint8_t *>(&word),
sizeof(word));
+ ScreenStreamer::writeBytes(&word, sizeof(word));
return sizeof(uint32_t);
}
size_t writeLongWord(uint64_t word) {
- ScreenStreamer::writeBytes(reinterpret_cast<uint8_t *>(&word),
sizeof(word));
+ ScreenStreamer::writeBytes(&word, sizeof(word));
return sizeof(uint64_t);
}
- size_t writeBytes(const uint8_t *bytes, size_t size) {
+ size_t writeBytes(const void *bytes, size_t size) {
+ const uint8_t *ptr = reinterpret_cast<const uint8_t *>(bytes);
for (size_t i= 0; i < size; ++i) {
- ScreenStreamer::writeByte(*bytes++);
+ ScreenStreamer::writeByte(*ptr++);
}
std::cout << std::endl;
return size;
@@ -111,7 +112,7 @@
return sizeof(uint64_t);
}
- size_t writeBytes(const uint8_t *bytes, size_t size) {
+ size_t writeBytes(const void *bytes, size_t size) {
os_.write(reinterpret_cast<const char *>(bytes), size);
return size;
}
Modified: hadoop/avro/trunk/lang/c++/api/Serializer.hh
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/Serializer.hh?rev=902299&r1=902298&r2=902299&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/Serializer.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/Serializer.hh Fri Jan 22 22:41:02 2010
@@ -69,7 +69,7 @@
writer_.writeValue(val);
}
- void writeBytes(const uint8_t *val, size_t size) {
+ void writeBytes(const void *val, size_t size) {
writer_.writeBytes(val);
}
Modified: hadoop/avro/trunk/lang/c++/api/ValidatingWriter.hh
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/ValidatingWriter.hh?rev=902299&r1=902298&r2=902299&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/ValidatingWriter.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/ValidatingWriter.hh Fri Jan 22 22:41:02 2010
@@ -54,8 +54,7 @@
validator_.advance();
}
- void writeBytes(const uint8_t *val, size_t size);
-
+ void writeBytes(const void *val, size_t size);
template <size_t N>
void writeFixed(const uint8_t (&val)[N]) {
Modified: hadoop/avro/trunk/lang/c++/api/Writer.hh
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/Writer.hh?rev=902299&r1=902298&r2=902299&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/Writer.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/Writer.hh Fri Jan 22 22:41:02 2010
@@ -78,10 +78,10 @@
}
void writeValue(const std::string &val) {
- writeBytes(reinterpret_cast<const uint8_t *>(val.c_str()), val.size());
+ writeBytes(val.c_str(), val.size());
}
- void writeBytes(const uint8_t *val, size_t size) {
+ void writeBytes(const void *val, size_t size) {
this->writeValue(static_cast<int64_t>(size));
out_.writeBytes(val, size);
}
Modified: hadoop/avro/trunk/lang/c++/impl/ValidatingWriter.cc
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/impl/ValidatingWriter.cc?rev=902299&r1=902298&r2=902299&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/impl/ValidatingWriter.cc (original)
+++ hadoop/avro/trunk/lang/c++/impl/ValidatingWriter.cc Fri Jan 22 22:41:02 2010
@@ -31,7 +31,7 @@
{ }
void
-ValidatingWriter::writeBytes(const uint8_t *val, size_t size)
+ValidatingWriter::writeBytes(const void *val, size_t size)
{
checkSafeToPut(AVRO_BYTES);
writer_.writeBytes(val, size);