joao-r-reis commented on code in PR #1899: URL: https://github.com/apache/cassandra-gocql-driver/pull/1899#discussion_r2181267273
########## marshal.go: ########## @@ -636,26 +644,30 @@ func (intTypeInfo) Marshal(value interface{}) ([]byte, error) { // Unmarshal unmarshals the byte slice into the value. func (i intTypeInfo) Unmarshal(data []byte, value interface{}) error { + decodedData, err := decInt(data) + if err != nil { + return unmarshalErrorf("%s", err.Error()) + } if iptr, ok := value.(*interface{}); ok && iptr != nil { var v int - if err := unmarshalIntlike(TypeInt, int64(decInt(data)), data, &v); err != nil { + if err := unmarshalIntlike(TypeInt, int64(decodedData), data, &v); err != nil { return err } *iptr = v return nil } - return unmarshalIntlike(TypeInt, int64(decInt(data)), data, value) + return unmarshalIntlike(TypeInt, int64(decodedData), data, value) } func encInt(x int32) []byte { return []byte{byte(x >> 24), byte(x >> 16), byte(x >> 8), byte(x)} } -func decInt(x []byte) int32 { +func decInt(x []byte) (int32, error) { if len(x) != 4 { - return 0 + return 0, fmt.Errorf("expected 4 bytes decoding int but got %v", len(x)) Review Comment: > I'm confused, isn't this going to make NULL now return an error instead of 0 like it did before? Yeah I started seeing a couple of test failures and I noticed that, was just working on it now. Should be fixed now. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org