Skip to content

Commit

Permalink
Use std::string for g_altern_map_file
Browse files Browse the repository at this point in the history
string_view::data() doesn't guarantee that the resulting pointer is a
NUL terminated string, so use string::c_str() instead.
  • Loading branch information
LegalizeAdulthood committed Jan 10, 2025
1 parent 85adb50 commit 439fbb2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libid/fractals/jb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ bool julibrot_setup()
}
else
{
map_name = g_altern_map_file.data();
map_name = g_altern_map_file.c_str();
}
if (g_save_dac != 1)
{
Expand Down
4 changes: 2 additions & 2 deletions libid/include/starfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//
#pragma once

#include <string_view>
#include <string>

extern const std::string_view g_altern_map_file;
extern const std::string g_altern_map_file;

int get_star_field_params();
int star_field();
4 changes: 2 additions & 2 deletions libid/starfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "ValueSaver.h"
#include "video.h"

const std::string_view g_altern_map_file{"altern.map"};
const std::string g_altern_map_file{"altern.map"};

static int s_distribution{30};
static int s_slope{25};
Expand Down Expand Up @@ -75,7 +75,7 @@ int star_field()
s_concentration = (long)(((s_star_field_values[1]) / 100.0) * (1L << 16));
s_slope = (int)(s_star_field_values[2]);

if (validate_luts(g_altern_map_file.data()))
if (validate_luts(g_altern_map_file.c_str()))
{
stop_msg("Unable to load ALTERN.MAP");
g_busy = false;
Expand Down

0 comments on commit 439fbb2

Please sign in to comment.