File: NSCFString-missing-methods.patch

package info (click to toggle)
gnustep-corebase 0.1.1%2B20230710-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,608 kB
  • sloc: ansic: 25,359; objc: 4,347; cpp: 75; xml: 49; makefile: 24; sh: 7
file content (27 lines) | stat: -rw-r--r-- 812 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Description: Implement -cString and -UTF8String.
 This is required so that [(CFStringRef)str UTF8String] works.  It got
 broken upstream when CFString was rewritten in C.
Author: Yavor Doganov <yavor@gnu.org>
Forwarded: no
Last-Update: 2024-09-26
---

--- gnustep-corebase-0.1.1+20230710.orig/Source/NSCFString.m
+++ gnustep-corebase-0.1.1+20230710/Source/NSCFString.m
@@ -195,6 +195,16 @@
   return (NSUInteger)CFStringGetLength ((CFStringRef) self);
 }
 
+- (const char *) UTF8String
+{
+  return CFStringGetCStringPtr ((CFStringRef) self, kCFStringEncodingUTF8);
+}
+
+- (const char *) cString
+{
+  return CFStringGetCStringPtr ((CFStringRef) self, kCFStringEncodingASCII);
+}
+
 - (unichar) characterAtIndex: (NSUInteger) index
 {
   return (unichar)CFStringGetCharacterAtIndex ((CFStringRef) self, index);