~ubuntu-branches/debian/stretch/assaultcube-data/stretch

« back to all changes in this revision

Viewing changes to source/xcode/macutils.mm

  • Committer: Bazaar Package Importer
  • Author(s): Gonéri Le Bouder, Ansgar Burchardt, Gonéri Le Bouder
  • Date: 2010-04-02 23:37:55 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100402233755-kf74fxwlu634o6vg
Tags: 1.0.4+repack1-1
[ Ansgar Burchardt ]
* debian/control: fix typo in short description

[ Gonéri Le Bouder ]
* Upgrade to 1.0.4
* bump standards-version to 3.8.4
* Add Depends: ${misc:Depends} just to avoid a lintian warning
* Add a debian/source/format file for the same reason

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#import <Cocoa/Cocoa.h>
 
2
 
 
3
#define MAXSTRLEN 260
 
4
inline char *s_strncpy(char *d, const char *s, size_t m) { strncpy(d,s,m); d[m-1] = 0; return d; };
 
5
inline char *s_strcat(char *d, const char *s) { size_t n = strlen(d); return s_strncpy(d+n,s,MAXSTRLEN-n); };
 
6
 
 
7
void mac_pasteconsole(char *commandbuf)
 
8
{       
 
9
    NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
 
10
    NSString *type = [pasteboard availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]];
 
11
    if (type != nil) {
 
12
        NSString *contents = [pasteboard stringForType:type];
 
13
        if (contents != nil)
 
14
                        s_strcat(commandbuf, [contents lossyCString]);
 
15
    }
 
16
}
 
17
 
 
18
/*
 
19
 * 0x1030 = 10.3
 
20
 * 0x1040 = 10.4
 
21
 * 0x1050 = 10.5
 
22
 */
 
23
int mac_osversion() 
 
24
{
 
25
    SInt32 MacVersion;
 
26
    Gestalt(gestaltSystemVersion, &MacVersion);
 
27
    return MacVersion;
 
28
}