Skip to content

Commit

Permalink
Widen property type to be able to carry all values #1493
Browse files Browse the repository at this point in the history
  • Loading branch information
icraggs committed Jul 13, 2024
1 parent 3d7a1a6 commit 292bf28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/MQTTProperties.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2020 IBM Corp. and others
* Copyright (c) 2017, 2024 IBM Corp. and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down Expand Up @@ -475,10 +475,10 @@ int MQTTProperties_propertyCount(MQTTProperties *props, enum MQTTPropertyCodes p
}


int MQTTProperties_getNumericValueAt(MQTTProperties *props, enum MQTTPropertyCodes propid, int index)
int64_t MQTTProperties_getNumericValueAt(MQTTProperties *props, enum MQTTPropertyCodes propid, int index)
{
int i = 0;
int rc = -9999999;
int64_t rc = -9999999;
int cur_index = 0;

for (i = 0; i < props->count; ++i)
Expand Down Expand Up @@ -515,7 +515,7 @@ int MQTTProperties_getNumericValueAt(MQTTProperties *props, enum MQTTPropertyCod
}


int MQTTProperties_getNumericValue(MQTTProperties *props, enum MQTTPropertyCodes propid)
int64_t MQTTProperties_getNumericValue(MQTTProperties *props, enum MQTTPropertyCodes propid)
{
return MQTTProperties_getNumericValueAt(props, propid, 0);
}
Expand Down
8 changes: 5 additions & 3 deletions src/MQTTProperties.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2023 IBM Corp. and others
* Copyright (c) 2017, 2024 IBM Corp. and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand All @@ -19,6 +19,8 @@

#include "MQTTExportDeclarations.h"

#include <stdint.h>

#define MQTT_INVALID_PROPERTY_ID -2

/** The one byte MQTT V5 property indicator */
Expand Down Expand Up @@ -191,7 +193,7 @@ LIBMQTT_API int MQTTProperties_propertyCount(MQTTProperties *props, enum MQTTPro
* @param propid the property id to check for.
* @return the integer value of the property. -9999999 on failure.
*/
LIBMQTT_API int MQTTProperties_getNumericValue(MQTTProperties *props, enum MQTTPropertyCodes propid);
LIBMQTT_API int64_t MQTTProperties_getNumericValue(MQTTProperties *props, enum MQTTPropertyCodes propid);

/**
* Returns the integer value of a specific property when it's not the only instance.
Expand All @@ -201,7 +203,7 @@ LIBMQTT_API int MQTTProperties_getNumericValue(MQTTProperties *props, enum MQTTP
* @param index the instance number, starting at 0.
* @return the integer value of the property. -9999999 on failure.
*/
LIBMQTT_API int MQTTProperties_getNumericValueAt(MQTTProperties *props, enum MQTTPropertyCodes propid, int index);
LIBMQTT_API int64_t MQTTProperties_getNumericValueAt(MQTTProperties *props, enum MQTTPropertyCodes propid, int index);

/**
* Returns a pointer to the property structure for a specific property.
Expand Down

0 comments on commit 292bf28

Please sign in to comment.