Blame src/helper_functions.cpp

Packit 01d647
// ********************************************************* -*- C++ -*-
Packit 01d647
/*
Packit 01d647
 * Copyright (C) 2004-2018 Exiv2 authors
Packit 01d647
 * This program is part of the Exiv2 distribution.
Packit 01d647
 *
Packit 01d647
 * This program is free software; you can redistribute it and/or
Packit 01d647
 * modify it under the terms of the GNU General Public License
Packit 01d647
 * as published by the Free Software Foundation; either version 2
Packit 01d647
 * of the License, or (at your option) any later version.
Packit 01d647
 *
Packit 01d647
 * This program is distributed in the hope that it will be useful,
Packit 01d647
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 01d647
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 01d647
 * GNU General Public License for more details.
Packit 01d647
 *
Packit 01d647
 * You should have received a copy of the GNU General Public License
Packit 01d647
 * along with this program; if not, write to the Free Software
Packit 01d647
 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
Packit 01d647
 */
Packit 01d647
/*!
Packit 01d647
  @file    helper_functions.cpp
Packit 01d647
  @brief   A collection of helper functions
Packit 01d647
  @author  Dan Čermák (D4N)
Packit 01d647
           dan.cermak@cgc-instruments.com
Packit 01d647
  @date    25-May-18, D4N: created
Packit 01d647
 */
Packit 01d647
Packit 01d647
#include "helper_functions.hpp"
Packit 01d647
Packit 01d647
#include <string.h>
Packit 01d647
Packit 01d647
Packit 01d647
std::string string_from_unterminated(const char* data, size_t data_length)
Packit 01d647
{
Packit 01d647
    const size_t StringLength = strnlen(data, data_length);
Packit 01d647
Packit 01d647
    return std::string(data, StringLength);
Packit 01d647
}