Closed GoogleCodeExporter closed 9 years ago
I'm a bit wary about truncating data. Generally, truncated data is pretty much
incorrect data.
Is there a specific reason why truncating would be ok in your case?
Providing an option for this would be possible, but I'm not yet convinced that
this is widely enough useful. One thing that might make sense is to allow
optional fields to be skipped if the data does not fit.
Original comment by Petteri.Aimonen
on 1 Feb 2014 at 7:09
I agree that truncating bytes fields would not make too much sense. In some
cases however, a string could be truncated if it's a short message that might
occasionally exceed the defined max_size field if one system isn't fully aware
of the max_size restriction.
Provided repeated fields are packed, they might be used to indicate the result
of a data query. If the system not using nanopb didn't keep track of the
max_count information, it could often respond with too much data for the
max_count field.
Neither situation is that common, I'll admit. Though they would be useful in a
few cases in the system with which I'm working. Another thought is perhaps a
separate field option (max_size_trunc / max_count_trunc or some such), but that
seems like even more work than preprocessor macros.
Original comment by tullisar
on 2 Feb 2014 at 5:36
Too rare usecase. Better handled using callbacks or custom patch.
Original comment by Petteri.Aimonen
on 2 Apr 2014 at 6:26
Original issue reported on code.google.com by
tullisar
on 31 Jan 2014 at 1:08Attachments: