Skip to content

Commit

Permalink
Fix tabs/spaces issues
Browse files Browse the repository at this point in the history
  • Loading branch information
milindl committed Aug 23, 2022
1 parent fb703ac commit eab29a1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/confluent_kafka/src/confluent_kafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,25 +871,25 @@ static int TopicPartition_init (PyObject *self, PyObject *args,
return -1;
}

// To maintain compability with librdkafka, TopicPartition's metadata
// is `bytes`, but we expect it to be a utf-8 encoded string with no
// null characters embedded, as expected by the kafka protocol.
for (int i = 0; i < metadata.len; i++) {
// To maintain compability with librdkafka, TopicPartition's metadata
// is `bytes`, but we expect it to be a utf-8 encoded string with no
// null characters embedded, as expected by the kafka protocol.
for (int i = 0; i < metadata.len; i++) {
if (((char*)metadata.buf)[i] == 0) {
PyErr_SetString(PyExc_ValueError,
"embedded null character");
"embedded null character");
PyBuffer_Release(&metadata);
return -1;
}
}
}
}

TopicPartition_setup((TopicPartition *)self,
topic, partition, offset,
metadata.buf, metadata.len, 0);

if (metadata.len > 0) {
PyBuffer_Release(&metadata);
}
if (metadata.len > 0) {
PyBuffer_Release(&metadata);
}

return 0;
}
Expand Down

0 comments on commit eab29a1

Please sign in to comment.