Skip to content

Commit 22860df

Browse files
committed
fix: Change logic
1 parent 8b5c6d4 commit 22860df

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/c2pa/c2pa.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,19 +1367,19 @@ def wrapped_callback(
13671367
if not data_ptr or data_len <= 0:
13681368
# Error: invalid input, native code will handle if seeing
13691369
# signature size being 0
1370-
return 0
1370+
return -1
13711371

13721372
# Convert C pointer to Python bytes
13731373
data = bytes(data_ptr[:data_len])
13741374
if not data:
13751375
# Error: empty data, native code will handle it!
1376-
return 0
1376+
return -1
13771377

13781378
# Call the user's callback
13791379
signature = callback(data)
13801380
if not signature:
13811381
# Error: empty signature, native code will handle that too!
1382-
return 0
1382+
return -1
13831383

13841384
# Copy the signature back to the C buffer (since callback is
13851385
# sued in native code)
@@ -1393,7 +1393,7 @@ def wrapped_callback(
13931393
print(
13941394
error_messages['callback_error'].format(
13951395
str(e)), file=sys.stderr)
1396-
return 0
1396+
return -1
13971397

13981398
# Encode strings with error handling in case it's invalid UTF8
13991399
try:

tests/test_unit_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
class TestC2paSdk(unittest.TestCase):
4141
def test_sdk_version(self):
42-
self.assertIn("0.57.0", sdk_version())
42+
self.assertIn("0.55.0", sdk_version())
4343

4444

4545
class TestReader(unittest.TestCase):

0 commit comments

Comments
 (0)