forked from reaper-oss/sws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ReaScript: add NF_Base64_Decode(), NF_Base64_Encode()
closes reaper-oss#778 # delete unused NF_GetProjectStartupAction_CmdID()
- Loading branch information
1 parent
fc099cf
commit 3183e36
Showing
7 changed files
with
115 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ PRIVATE | |
envelope.cpp | ||
hidpi.cpp | ||
RazorEditArea.cpp | ||
ReaScript_Utility.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/****************************************************************************** | ||
/ ReaScript_Utilty.cpp | ||
/ | ||
/ Copyright (c) 2022 ReaTeam | ||
/ | ||
/ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
/ of this software and associated documentation files (the "Software"), to deal | ||
/ in the Software without restriction, including without limitation the rights to | ||
/ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
/ of the Software, and to permit persons to whom the Software is furnished to | ||
/ do so, subject to the following conditions: | ||
/ | ||
/ The above copyright notice and this permission notice shall be included in all | ||
/ copies or substantial portions of the Software. | ||
/ | ||
/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
/ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
/ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
/ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
/ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
/ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
/ OTHER DEALINGS IN THE SOFTWARE. | ||
/ | ||
******************************************************************************/ | ||
|
||
#include "stdafx.h" | ||
#include <cstring> | ||
|
||
#include "ReaScript_Utility.hpp" | ||
|
||
// from https://github.com/cfillion/reaimgui/blob/b31d7fa6cf317167d363dc7882a193cc03f90762/api/input.cpp#L27-L39 | ||
void CopyToBuffer(const char* value, char* buf, const size_t bufSize) | ||
{ | ||
int newSize{}; | ||
const size_t valuestrlen = strlen(value); | ||
if (valuestrlen >= bufSize && realloc_cmd_ptr(&buf, &newSize, valuestrlen)) { | ||
// the buffer is no longer null-terminated after using realloc_cmd_ptr! | ||
std::memcpy(buf, value, newSize); | ||
} | ||
else { | ||
const size_t limit{ std::min(bufSize - 1, valuestrlen) }; | ||
std::memcpy(buf, value, limit); | ||
buf[limit] = '\0'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/****************************************************************************** | ||
/ ReaScript_Utility.hpp | ||
/ | ||
/ Copyright (c) 2022 ReaTeam | ||
/ | ||
/ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
/ of this software and associated documentation files (the "Software"), to deal | ||
/ in the Software without restriction, including without limitation the rights to | ||
/ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
/ of the Software, and to permit persons to whom the Software is furnished to | ||
/ do so, subject to the following conditions: | ||
/ | ||
/ The above copyright notice and this permission notice shall be included in all | ||
/ copies or substantial portions of the Software. | ||
/ | ||
/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
/ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
/ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
/ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
/ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
/ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
/ OTHER DEALINGS IN THE SOFTWARE. | ||
/ | ||
******************************************************************************/ | ||
#pragma once | ||
|
||
void CopyToBuffer(const char* value, char* buf, const size_t bufSize); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters