Permalink
Browse files

Use mrb_string_value_cstr() instead of mrb_string_value_ptr()

  • Loading branch information...
ongaeshi committed Jan 5, 2018
1 parent 9996d42 commit f1a1264c34af4df4b0b2e1dbb9b96f0e8c7acbc2
Showing with 9 additions and 9 deletions.
  1. +1 −1 App/MrubyUtil.m
  2. +1 −1 App/mrb_image.m
  3. +7 −7 App/mrb_misc.m
View
@@ -15,7 +15,7 @@ @implementation MrubyUtil {
}
+ (NSString*) str2nstr:(mrb_state*)mrb value:(mrb_value)value {
const char *cstr = mrb_string_value_ptr(mrb, value);
const char *cstr = mrb_string_value_cstr(mrb, &value);
return [[NSString alloc] initWithUTF8String:cstr];
}
View
@@ -53,7 +53,7 @@
{
mrb_value str;
mrb_get_args(mrb, "S", &str);
const char *path = mrb_string_value_ptr(mrb, str);
const char *path = mrb_string_value_cstr(mrb, &str);
NSString *npath = [[NSString alloc] initWithUTF8String:path];
NSError *error = nil;
View
@@ -17,7 +17,7 @@
printstr_in(mrb_state *mrb, mrb_value obj)
{
if (mrb_string_p(obj)) {
const char* cstr = mrb_string_value_ptr(mrb, obj);
const char* cstr = mrb_string_value_cstr(mrb, &obj);
NSString* nstr = [[NSString alloc] initWithUTF8String:cstr];
// NSLog(@"%@", nstr);
[globalMrubyViewController printstr:nstr];
@@ -155,7 +155,7 @@ void rubypico_misc_p(mrb_state *mrb, mrb_value obj)
mrb_value str;
mrb_get_args(mrb, "S", &str);
const char* path = mrb_string_value_ptr(mrb, str);
const char* path = mrb_string_value_cstr(mrb, &str);
NSString *npath = [[NSString alloc] initWithUTF8String:path];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
@@ -170,7 +170,7 @@ void rubypico_misc_p(mrb_state *mrb, mrb_value obj)
mrb_value str;
mrb_get_args(mrb, "S", &str);
const char* cstr = mrb_string_value_ptr(mrb, str);
const char* cstr = mrb_string_value_cstr(mrb, &str);
NSString* nstr = [[NSString alloc] initWithUTF8String:cstr];
NSString* encodeString = [nstr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet alphanumericCharacterSet]];
@@ -186,7 +186,7 @@ void rubypico_misc_p(mrb_state *mrb, mrb_value obj)
mrb_value str;
mrb_get_args(mrb, "S", &str);
const char* cstr = mrb_string_value_ptr(mrb, str);
const char* cstr = mrb_string_value_cstr(mrb, &str);
NSString* nstr = [[NSString alloc] initWithUTF8String:cstr];
NSURL *url = [NSURL URLWithString:nstr];
@@ -209,7 +209,7 @@ void rubypico_misc_p(mrb_state *mrb, mrb_value obj)
mrb_value str;
mrb_get_args(mrb, "S", &str);
const char* cstr = mrb_string_value_ptr(mrb, str);
const char* cstr = mrb_string_value_cstr(mrb, &str);
NSString* nstr = [[NSString alloc] initWithUTF8String:cstr];
NSURL *url = [NSURL URLWithString:nstr];
@@ -284,7 +284,7 @@ void rubypico_misc_p(mrb_state *mrb, mrb_value obj)
mrb_value str;
mrb_get_args(mrb, "S", &str);
const char* path = mrb_string_value_ptr(mrb, str);
const char* path = mrb_string_value_cstr(mrb, &str);
NSString *npath = [[NSString alloc] initWithUTF8String:path];
dispatch_sync(dispatch_get_main_queue(), ^{
@@ -300,7 +300,7 @@ void rubypico_misc_p(mrb_state *mrb, mrb_value obj)
mrb_value str;
mrb_get_args(mrb, "S", &str);
const char* path = mrb_string_value_ptr(mrb, str);
const char* path = mrb_string_value_cstr(mrb, &str);
NSString *npath = [[NSString alloc] initWithUTF8String:path];
dispatch_sync(dispatch_get_main_queue(), ^{

0 comments on commit f1a1264

Please sign in to comment.