<commit_before>//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp.  All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////


// SYSTEM INCLUDES
#include <string.h>
#include <limits.h>

// APPLICATION INCLUDES
#include "utl/UtlIntPtr.h"

// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STATIC VARIABLE INITIALIZATIONS
UtlContainableType UtlIntPtr::TYPE = "UtlIntPtr";

/* //////////////////////////// PUBLIC //////////////////////////////////// */

/* ============================ CREATORS ================================== */

// Constructor accepting an optional default value.
UtlIntPtr::UtlIntPtr(intptr_t value) : mValue(value)
{
} 


// Copy constructor
UtlIntPtr::UtlIntPtr(const UtlIntPtr& rhs) : mValue(rhs.mValue)
{
}

// Destructor
UtlIntPtr::~UtlIntPtr()
{
}

UtlCopyableContainable* UtlIntPtr::clone() const
{
   return new UtlIntPtr(*this); 
}

/* ============================ OPERATORS ============================== */

// Prefix increment operator
UtlIntPtr& UtlIntPtr::operator++() {
    mValue++;
    return *this;
}

// Postfix increment operator
UtlIntPtr UtlIntPtr::operator++(int) {
    UtlIntPtr temp = *this;
    ++*this;
    return temp;
}

// Prefix decrement operator
UtlIntPtr& UtlIntPtr::operator--() {
    mValue--;
    return *this;
}

// Postfix decrement operator
UtlIntPtr UtlIntPtr::operator--(int) {
    UtlIntPtr temp = *this;
    --*this;
    return temp;
}

UtlIntPtr& UtlIntPtr::operator=(const UtlIntPtr& rhs)
{
   if (this == &rhs)            // handle the assignment to self case
      return *this;

   // Assign values
   mValue = rhs.mValue;

   return *this;
}

/* ============================ MANIPULATORS ============================== */

intptr_t UtlIntPtr::setValue(intptr_t iValue)
{
    int iOldValue = mValue ;
    mValue = iValue ;

    return iOldValue ;
}

/* ============================ ACCESSORS ================================= */

intptr_t UtlIntPtr::getValue() const 
{
    return mValue ; 
}


unsigned UtlIntPtr::hash() const
{
   return mValue ; 
}


UtlContainableType UtlIntPtr::getContainableType() const
{
    return UtlIntPtr::TYPE ;
}

/* ============================ INQUIRY =================================== */

int UtlIntPtr::compareTo(UtlContainable const * inVal) const
{
   int result ; 
   
   if (inVal->isInstanceOf(UtlIntPtr::TYPE))
    {
        UtlIntPtr* temp = (UtlIntPtr*)inVal ; 
        intptr_t inInt = temp->getValue() ; 
        result = mValue - inInt ; 
    }
    else
    {
        result = INT_MAX ; 
    }

    return result ;
}
<commit_msg>Fix 64-bit bug in UtlIntPtr - trying to exchange two 64-bit values using 32-bit temp variable. Also some minor warning fixes.<commit_after>//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp.  All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////


// SYSTEM INCLUDES
#include <string.h>
#include <limits.h>

// APPLICATION INCLUDES
#include "utl/UtlIntPtr.h"

// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STATIC VARIABLE INITIALIZATIONS
UtlContainableType UtlIntPtr::TYPE = "UtlIntPtr";

/* //////////////////////////// PUBLIC //////////////////////////////////// */

/* ============================ CREATORS ================================== */

// Constructor accepting an optional default value.
UtlIntPtr::UtlIntPtr(intptr_t value) : mValue(value)
{
} 


// Copy constructor
UtlIntPtr::UtlIntPtr(const UtlIntPtr& rhs) : mValue(rhs.mValue)
{
}

// Destructor
UtlIntPtr::~UtlIntPtr()
{
}

UtlCopyableContainable* UtlIntPtr::clone() const
{
   return new UtlIntPtr(*this); 
}

/* ============================ OPERATORS ============================== */

// Prefix increment operator
UtlIntPtr& UtlIntPtr::operator++() {
    mValue++;
    return *this;
}

// Postfix increment operator
UtlIntPtr UtlIntPtr::operator++(int) {
    UtlIntPtr temp = *this;
    ++*this;
    return temp;
}

// Prefix decrement operator
UtlIntPtr& UtlIntPtr::operator--() {
    mValue--;
    return *this;
}

// Postfix decrement operator
UtlIntPtr UtlIntPtr::operator--(int) {
    UtlIntPtr temp = *this;
    --*this;
    return temp;
}

UtlIntPtr& UtlIntPtr::operator=(const UtlIntPtr& rhs)
{
   if (this == &rhs)            // handle the assignment to self case
      return *this;

   // Assign values
   mValue = rhs.mValue;

   return *this;
}

/* ============================ MANIPULATORS ============================== */

intptr_t UtlIntPtr::setValue(intptr_t iValue)
{
    intptr_t iOldValue = mValue ;
    mValue = iValue ;

    return iOldValue ;
}

/* ============================ ACCESSORS ================================= */

intptr_t UtlIntPtr::getValue() const 
{
    return mValue ; 
}


unsigned UtlIntPtr::hash() const
{
   return (unsigned)mValue ; 
}


UtlContainableType UtlIntPtr::getContainableType() const
{
    return UtlIntPtr::TYPE ;
}

/* ============================ INQUIRY =================================== */

int UtlIntPtr::compareTo(UtlContainable const * inVal) const
{
   int result ; 
   
   if (inVal->isInstanceOf(UtlIntPtr::TYPE))
    {
        UtlIntPtr* temp = (UtlIntPtr*)inVal ; 
        intptr_t inInt = temp->getValue() ; 
        result = (int)(mValue - inInt); 
    }
    else
    {
        result = INT_MAX ; 
    }

    return result ;
}

{'fraction_non_alphanumeric': 0.2651072124756335, 'fraction_numerical': 0.006734006734006734, 'mean_word_length': 2.844686648501362, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2116456', 'n_tokens_mistral': 1897, 'n_tokens_neox': 1791, 'n_words': 389}